wbs.K.cpt {breakfast}R Documentation

Detecting exactly K change-points in the mean of a vector using the Adaptive WBS method

Description

This function estimates the number and locations of change-points in the piecewise-constant mean of the noisy input vector, using the Adaptive Wild Binary Segmentation method (see Details for the relevant literature reference). The number of change-points is exactly K. The constant means between each pair of neighbouring change-points are also estimated. The method works best when the noise in the input vector is independent and identically distributed Gaussian. As a by-product, the function also computes the entire solution path, i.e. all estimated n-1 change-point locations (where n is the length of the input data) sorted from the most to the least important.

Usage

wbs.K.cpt(x, K, M = 1000)

Arguments

x

A vector containing the data in which you wish to find change-points.

K

The number of change-points you wish to detect.

M

The number of randomly selected sub-segments of the data on which to build the CUSUM statistics on each recursively identified interval in the Adaptive Wild Binary Segmentation algorithm.

Details

This function should only be used if (a) you know exactly how many change-points you wish to detect, or (b) you wish to order all possible change-points from the most to the least important. If you need a function to estimate the number of change-points for you, try segment.mean (for a default recommended estimation technique), wbs.thresh.cpt, wbs.bic.cpt, wbs.cpt (if you require an (Adaptive) WBS-based technique), tguh.cpt (if you require a TGUH-based technique), or hybrid.cpt (to use a hybrid between TGUH and Adaptive WBS). If you are unsure where to start, try segment.mean.

The change-point detection algorithm used in wbs.K.cpt is the Adaptive Wild Binary Segmentaton method as described in "Data-adaptive Wild Binary Segmentation", P. Fryzlewicz (2017), in preparation as of September 28th, 2017.

Value

A list with the following components:

est

The estimated piecewise-constant mean of x.

no.of.cpt

The estimated number of change-points in the piecewise-constant mean of x; the minumum of K and n-1, where n is the length of x

cpt

The estimated locations of change-points in the piecewise-contant mean of x (these are the final indices before the location of each change-point).

cpt.sorted

The list of all possible change-point locations, sorted from the most to the least likely

Author(s)

Piotr Fryzlewicz, p.fryzlewicz@lse.ac.uk

See Also

segment.mean, wbs.thresh.cpt, wbs.cpt, tguh.cpt, hybrid.cpt, wbs.bic.cpt

Examples

teeth <- rep(rep(0:1, each=5), 20)
teeth.noisy <- teeth + rnorm(200)/5
teeth.cleaned <- wbs.K.cpt(teeth.noisy, 39)
teeth.cleaned$cpt
teeth.cleaned <- wbs.K.cpt(teeth.noisy, 78)
teeth.cleaned$cpt
teeth.cleaned$cpt.sorted

[Package breakfast version 1.0.0 Index]