tguh.cpt {breakfast}R Documentation

Multiple change-point detection in the mean of a vector using the TGUH method

Description

This function estimates the number and locations of change-points in the piecewise-constant mean of the noisy input vector, using the Tail-Greedy Unbalanced Haar method (see Details for the relevant literature reference). It also estimates the constant means between each pair of neighbouring change-points. It works best when the noise in the input vector is independent and identically distributed Gaussian.

Usage

tguh.cpt(x, sigma = stats::mad(diff(x)/sqrt(2)), th.const = 1, p = 0.01,
  minseglen = 1, bal = 1/20, num.zero = 10^(-5))

Arguments

x

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

sigma

The estimate or estimator of the standard deviation of the noise in x; the default is the Median Absolute Deviation of x computed under the assumption that the noise is independent and identically distributed Gaussian.

th.const

Tuning parameter. Change-points are estimated by connected thresholding (of the Tail-Greedy Unbalanced Haar decomposition of x) in which the threshold has magnitude sigma * sqrt(2 * (1 + 0.01) * log(n)) * th.const, where n is the length of x. The default value of th.const is 1.

p

Specifies the number of region pairs merged in each pass through the data, as the proportion of all remaining region pairs. The default is 0.01.

minseglen

The minimum permitted length of each segment of constancy in the estimated mean of x; the default is 1.

bal

Specifies the minimum ratio of the length of the shorter wing of each Unbalanced Haar wavelet whose coefficient survives the thresholding, to the length of its support. The default is 0.05.

num.zero

Numerical zero; the default is 0.00001.

Details

The change-point detection algorithm used in tguh.cpt is the Tail-Greedy Unbalanced Haar method as described in "Tail-greedy bottom-up data decompositions and fast multiple change-point detection", P. Fryzlewicz (2017), preprint. This paper describes two optional post-processing steps; neither of them is implemented in this package.

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.

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).

Author(s)

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

See Also

segment.mean, hybrid.cpt, tguh.decomp, tguh.denoise, tguh.reconstr

Examples

stairs <- rep(1:50, each=10)
stairs.noisy <- stairs + rnorm(500)/5
stairs.cleaned <- tguh.cpt(stairs.noisy)
ts.plot(stairs.cleaned$est)
stairs.cleaned$no.of.cpt
stairs.cleaned$cpt

[Package breakfast version 1.0.0 Index]