Learn R Programming

not (version 1.6)

features: Extract locations of features from a 'not' object

Description

The function applies user-specified stopping criteria to extract change-points from object generated by not.

Usage

features(object, ...)

# S3 method for default features(object, method = c("ic", "threshold"), penalty = c("sic", "aic", "user"), q.max = 25, penalty.fun, th, ...)

Value

th

Value of the threshold used (if method="threshold") or selected on the solution path (if method="ic").

cpt

Estimated locations of the change-points.

ic

Values of the information criterion minimised in order to find an optimal solution on the path (only if method="ic" was used).

Arguments

object

An object of 'not' class returned by not.

...

Further arguments that can be passed to the penalty function.

method

A method of choosing the best solution in object$solution.path. If method="ic", model minimising a chosen information criterion is selected. If method="threshold", model is selected based on thresholding (see references for more details).

penalty

Name of the penalty function to be used if method="ic". If penalty="user", a user-defined penalty function has to be passed via penalty.fun.

q.max

Maximum number of change-points allowed to be detected. Used only for method="ic".

penalty.fun

Used only if penalty="user". A function includes at least the following arguments: sample size n, number of parameters used in a model n.param, and .... For examples of such functions, see aic.penalty and sic.penalty.

th

Used only if method="threshold". A positive real number.

Details

Denote by \(T_{1}, \ldots, T_{N}\) the elements on the solution path object$solution.path, each representing a set of change-points. When (method="ic"), the returned set of change-points is the one that minimises $$-2\mbox{log-likelihood}(\code{object}, \code{cpt}=T_k)+\mbox{penalty}(\code{object\$n}, \code{n.param}, ...),$$ over all \(k\) such that the number of change-points in \(T_k\) is smaller than or equal q.max. The log-likelihood is computed using the logLik routine, while the penalty function is computed with sic.penalty (penalty="sic"), aic.penalty (penalty="aic") or a user-defined penalty function (penalty="user").

References

R. Baranowski, Y. Chen, and P. Fryzlewicz (2019). Narrowest-Over-Threshold Change-Point Detection. (http://stats.lse.ac.uk/fryzlewicz/not/not.pdf)

Examples

Run this code
# **** Piecewisce-constant mean with Gaussian noise.
x <- c(rep(0, 100), rep(1,100)) + rnorm(100)
# *** identify potential locations of the change-points
w <- not(x, contrast = "pcwsConstMean")
# *** choose change-points using default settings
fo <- features(w)
# *** get the change-points
fo$cpt
# *** plot the SIC curve
plot(fo$ic)

Run the code above in your browser using DataLab