FDRSeg (version 1.0-2)

smuce: Piecewise constant regression with SMUCE

Description

Compute the SMUCE estimator for one-dimensional data with i.i.d. Gaussian noises.

Usage

smuce(Y, q, alpha = 0.1, r = round(50/min(alpha, 1-alpha)), sd = stepR::sdrobnorm(Y))

Arguments

Y

a numeric vector containing the noisy data

q

threshold value; a scalar number

alpha

significance level; if q is missing, q is chosen as the (1-alpha)-quantile of the null distribution of the multiscale statistic via Monte Carlo simulation, see (Frick et al., 2014) for an explanation

r

numer of Monte Carlo simulations

sd

standard deviation of noises

Value

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

References

Frick, K., Munk, A., and Sieling, H. (2014). Multiscale Change-Point Inference. J. R. Statist. Soc. B, with discussion and rejoinder by the authors, 76:495--580.

Seiling, H. (2013). Statistical Multiscale Segmentation: Inference, Algorithms and Applications. PhD thesis, University of Goettingen, Germany.

See Also

fdrseg, dfdrseg, simulQuantile, sdrobnorm, evalStepFun, computeFdp, v_measure

Examples

Run this code
# NOT RUN {
# simulate data
set.seed(2)
u0 <- c(rep(1, 50), rep(5, 50))
Y  <- rnorm(100, u0)

# compute the estimate (q is automatically simulated)
uh <- smuce(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", "SMUCE"), lty = c(1, 1), col = c("blue", "red"))


# other choice of alpha
uh <- smuce(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", "SMUCE"), lty = c(1, 1), col = c("blue", "red"))

# }
# NOT RUN {
# alternatively simulate quantiles first
alpha <- 0.1
q     <- simulQuantile(1 - alpha, 100, type = "smuce")

# then compute the estimate
uh <- smuce(Y, q)
# }

Run the code above in your browser using DataLab