MRC {stepR} | R Documentation |
Compute Multiresolution Criterion
Description
Computes multiresolution coefficients, the corresponding criterion, simulates these for Gaussian white or coloured noise, based on which p-values and quantiles are obtained.
Deprecation warning: The function MRC.simul
is deprecated, but still working, however, may be defunct in a future version. Please use instead the function monteCarloSimulation
. An example how to reproduce results is given below. Some other functions are help function and might be removed, too.
Usage
MRC(x, lengths = 2^(floor(log2(length(x))):0), norm = sqrt(lengths),
penalty = c("none", "log", "sqrt"))
MRCoeff(x, lengths = 2^(floor(log2(length(x))):0), norm = sqrt(lengths), signed = FALSE)
MRC.simul(n, r, lengths = 2^(floor(log2(n)):0), penalty = c("none", "log", "sqrt"))
MRC.pvalue(q, n, r, lengths = 2^(floor(log2(n)):0), penalty = c("none", "log", "sqrt"),
name = ".MRC.table", pos = .MCstepR, inherits = TRUE)
MRC.FFT(epsFFT, testFFT, K = matrix(TRUE, nrow(testFFT), ncol(testFFT)), lengths,
penalty = c("none", "log", "sqrt"))
MRC.quant(p, n, r, lengths = 2^(floor(log2(n)):0), penalty = c("none", "log", "sqrt"),
name = ".MRC.table", pos = .MCstepR, inherits = TRUE, ...)
kMRC.simul(n, r, kern, lengths = 2^(floor(log2(n)):ceiling(log2(length(kern)))))
kMRC.pvalue(q, n, r, kern, lengths = 2^(floor(log2(n)):ceiling(log2(length(kern)))),
name = ".MRC.ktable", pos = .MCstepR, inherits = TRUE)
kMRC.quant(p, n, r, kern, lengths = 2^(floor(log2(n)):ceiling(log2(length(kern)))),
name = ".MRC.ktable", pos = .MCstepR, inherits = TRUE, ...)
Arguments
x |
a vector of numerical observations |
lengths |
vector of interval lengths to use, dyadic intervals by default |
signed |
whether signed coefficients should be returned |
q |
quantile |
n |
length of data set |
r |
number of simulations to use |
name , pos , inherits |
under which name and where precomputed results are stored, or retrieved, see |
K |
a |
epsFFT |
a vector containg the FFT of the data set |
testFFT |
a matrix containing the FFTs of the intervals |
kern |
a filter kernel |
penalty |
penalty term in the multiresolution statistic: |
norm |
how the partial sums should be normalised, by default |
p |
p-value |
... |
further arguments passed to function |
Value
MRC |
a vector giving the maximum as well as the indices of the corresponding interval's start and length |
MRCoeff |
a matrix giving the multiresolution coefficients for all test intervals |
MRC.pvalue , MRC.quant , MRC.simul |
the corresponding p-value / quantile / vector of simulated values under the assumption of standard Gaussian white noise |
kMRC.pvalue , kMRC.simul , kMRC.simul |
the corresponding p-value / quantile / vector of simulated values under the assumption of filtered Gaussian white noise |
References
Davies, P. L., Kovac, A. (2001) Local extremes, runs, strings and multiresolution. The Annals of Statistics 29, 1–65.
Dümbgen, L., Spokoiny, V. (2001) Multiscale testing of qualitative hypotheses. The Annals of Statistics 29, 124–152.
Siegmund, D. O., Venkatraman, E. S. (1995) Using the generalized likelihood ratio statistic for sequential detection of a change-point. The Annals of Statistics 23, 255–271.
Siegmund, D. O., Yakir, B. (2000) Tail probabilities for the null distribution of scanning statistics. Bernoulli 6, 191–213.
See Also
monteCarloSimulation
, smuceR
, jsmurf
, stepbound
, stepsel
, quantile
Examples
set.seed(100)
all.equal(MRC.simul(100, r = 100),
sort(monteCarloSimulation(n = 100, r = 100, output = "maximum",
penalty = "none", intervalSystem = "dyaLen")),
check.attributes = FALSE)
# simulate signal of 100 data points
set.seed(100)
f <- rep(c(0, 2, 0), c(60, 10, 30))
# add gaussian noise
x <- f + rnorm(100)
# compute multiresolution criterion
m <- MRC(x)
# compute Monte-Carlo p-value based on 100 simulations
MRC.pvalue(m["max"], length(x), 100)
# compute multiresolution coefficients
M <- MRCoeff(x)
# plot multiresolution coefficients, colours show p-values below 5% in 1% steps
op <- par(mar = c(5, 4, 2, 4) + 0.1)
image(1:length(x), seq(min(x), max(x), length = ncol(M)), apply(M[,ncol(M):1], 1:2,
MRC.pvalue, n = length(x), r = 100), breaks = (0:5) / 100,
col = rgb(1, seq(0, 1, length = 5), 0, 0.75),
xlab = "location / left end of interval", ylab ="measurement",
main = "Multiresolution Coefficients",
sub = paste("MRC p-value =", signif(MRC.pvalue(m["max"], length(x), 100), 3)))
axis(4, min(x) + diff(range(x)) * ( pretty(1:ncol(M) - 1) ) / dim(M)[2],
2^pretty(1:ncol(M) - 1))
mtext("interval lengths", 4, 3)
# plot signal and its mean
points(x)
lines(f, lty = 2)
abline(h = mean(x))
par(op)