Description Usage Arguments Value References See Also Examples
Compute the FDRSeg estimator for one-dimensional data with i.i.d. Gaussian noises.
1 |
Y |
a numeric vector containing the noisy data |
q |
threshold value; a numeric vector of the same length as the data |
alpha |
significance level; if |
r |
numer of Monte Carlo simulations |
sd |
standard deviation of noises |
A list with components
value |
function values on each segment of the estimator |
left |
indices of leftmost points within each segment of the estimator |
n |
number of samples |
Li, H., Munk, A., and Sieling, H. (2015). FDR-control in multiscale change-point segmentation. arXiv:1412.5844.
smuce
, dfdrseg
, simulQuantile
, sdrobnorm
, evalStepFun
, computeFdp
, v_measure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # simulate data
set.seed(123)
u0 <- c(rep(1, 50), rep(5, 50))
Y <- rnorm(100, u0)
# compute the estimate (q is automatically simulated)
# it might take a while due to simulating quantiles and will
# be faster for later calls on signals of the same length
uh <- fdrseg(Y)
# plot result
plot(Y, pch = 20, col = "grey", ylab = "", main = expression(alpha*" = 0.1"))
lines(u0, type = "s", col = "blue")
lines(evalStepFun(uh), type = "s", col = "red")
legend("topleft", c("Truth", "FDRSeg"), lty = c(1, 1), col = c("blue", "red"))
# other choice of alpha
uh <- fdrseg(Y, alpha = 0.05)
# plot result
plot(Y, pch = 20, col = "grey", ylab = "", main = expression(alpha*" = 0.05"))
lines(u0, type = "s", col = "blue")
lines(evalStepFun(uh), type = "s", col = "red")
legend("topleft", c("Truth", "FDRSeg"), lty = c(1, 1), col = c("blue", "red"))
## Not run:
# alternatively simulate quantiles first
alpha <- 0.1
q <- simulQuantile(1 - alpha, 100, type = "fdrseg")
# then compute the estimate
uh <- fdrseg(Y, q)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.