This function estimates the number and locations of change-points in the piecewise-constant or piecewise-linear mean of a noisy data sequence via thresholding.
model.thresh(cptpath.object, sigma = NULL, th.const = NULL)An S3 object of class cptmodel, which contains the following fields:
The solution path method used to obtain cptpath.object
The model type used, inherited from the given cptpath.object
The model selection method used to return the final change-point estimators object, here its value is "thresh"
The number of estimated change-points
The locations of estimated change-points
An estimate of the mean of the vector cptpath.object$x
A solution-path object, returned by a sol.[name] routine. The cptpath.object$type variable decides the model type: piecewise-constant (type == "const"),
piecewise-linear and continuous (type == "lin.cont") or piecewise-linear and discontinuous (type == "lin.discont"). In the piecewise-linear model (whether continuous or not), the output of sol.idetect_seq or sol.not should be supplied as
cptpath.object. Note that the field cptpath.object$x contains the input data sequence.
An estimate of the standard deviation of the noise in the data cptpath.object$x. Can be a functional of cptpath.object$x or a specific value if known.
The default in the piecewise-constant model is the Median Absolute Deviation of the vector diff(cptpath.object$x)/sqrt(2), tuned to the Gaussian distribution.
In the piecewise-linear models, diff(cptpath.object$x, differences = 2)/sqrt(6) is used by default.
Note that model.thresh works particularly well when the noise is i.i.d. Gaussian.
A positive real number used to define the threshold for the detection process. The default used in the piecewise-constant model is 1.15, while in the piecewise-linear model, the value is taken equal to 1.4.
sol.idetect, sol.idetect_seq, sol.not, sol.tguh, sol.wbs, sol.wbs2, breakfast
f <- rep(rep(c(0, 1), each = 50), 10)
x <- f + rnorm(length(f))
model.thresh(sol.idetect_seq(x))
Run the code above in your browser using DataLab