Learn R Programming

stepR (version 1.0-1)

smuceR: Piecewise constant regression with SMUCE

Description

Computes the SMUCE estimator for one-dimensional data.

Usage

smuceR(y, x = 1:length(y), x0 = 2 * x[1] - x[2], q = thresh.smuceR(length(y)), alpha, r,
  lengths, family = c("gauss", "gaussvar", "poisson", "binomial"), param,
  jumpint = confband, confband = FALSE)
thresh.smuceR(v)

Arguments

y
a numeric vector containing the serial data
x
a numeric vector of the same length as y containing the corresponding sample points
x0
a single numeric giving the last unobserved sample point directly before sampling started
q
threshold value, by default chosen automatically according to Frick et al.~(2013)
alpha
significance level; if set to a value in (0,1), q is chosen as the corresponding quantile of the asymptotic (if r is not given) null distribution (and any value specified for q is silently ignored)
r
numer of simulations; if specified along alpha, q is chosen as the corresponding quantile of the simulated null distribution
lengths
length of intervals considered; by default up to a sample size of 1000 all lengths, otherwise only dyadic lengths
family, param
specifies distribution of data, see family
jumpint
logical (FALSE by default), indicates if confidence sets for change-points should be computed
confband
logical, indicates if a confidence band for the piecewise-continuous function should be computed
v
number of data points

Value

  • For smuceR, an object of class stepfit that contains the fit; if jumpint = TRUE function jumpint allows to extract the 1- alpha confidence interval for the jumps, if confband = TRUE function confband allows to extract the 1- alpha confidence band.

    For thresh.smuceR, a precomputed threshhold value, see reference.

References

Frick, K., Munk, A., and Sieling, H. (2014). Multiscale Change-Point Inference. With discussion and rejoinder by the authors. Journal of the Royal Statistical Society, Series B 76(3), 495-580. Futschik, A., Hotz, T., Munk, A. Sieling, H. (2013). Multiresolution DNA partitioning: statistical evidence for segments. Bioinformatics, online first: http://bioinformatics.oxfordjournals.org/content/early/2014/05/09/bioinformatics.btu180.full.

See Also

stepbound, bounds, family, MRC.asymptotic, sdrobnorm, stepfit

Examples

Run this code
# simulate poisson data with two levels
y <- rpois(100, c(rep(1, 50), rep(4, 50)))
# compute fit, q is chosen automatically
fit <- smuceR(y, family="poisson", confband = TRUE)
# plot result
plot(y)
lines(fit)
# plot confidence intervals for jumps on axis
points(jumpint(fit), col="blue")
# confidence band
lines(confband(fit), lty=2, col="blue")

# simulate binomial data with two levels
y <- rbinom(200,3,rep(c(0.1,0.7),c(110,90)))
# compute fit, q is the 0.9-quantile of the (asymptotic) null distribution
fit <- smuceR(y, alpha=0.1, family="binomial", param=3, confband = TRUE)
# plot result
plot(y)
lines(fit)
# plot confidence intervals for jumps on axis
points(jumpint(fit), col="blue")
# confidence band
lines(confband(fit), lty=2, col="blue")

Run the code above in your browser using DataLab