segment.mean {breakfast}R Documentation

Multiple change-point detection in the mean of a vector

Description

This function estimates the number and locations of change-points in the piecewise-constant mean of the noisy input vector, using a method that puts more emphasis either on "speed" (i.e. is faster but possibly less accurate) or on "accuracy" (i.e. is possibly more accurate but slower). 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

segment.mean(x, attribute = "speed", M = 1000,
  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.

attribute

As described in the Details section of this help file.

M

The same as the corresponding parameter in hybrid.cpt.

sigma

The same as the corresponding parameter in tguh.cpt and hybrid.cpt.

th.const

The same as the corresponding parameter in tguh.cpt and hybrid.cpt.

p

The same as the corresponding parameter in tguh.cpt and hybrid.cpt.

minseglen

The same as the corresponding parameter in tguh.cpt and hybrid.cpt.

bal

The same as the corresponding parameter in tguh.cpt and hybrid.cpt.

num.zero

The same as the corresponding parameter in tguh.cpt and hybrid.cpt.

Details

In the current version of the package, attribute="speed" triggers the function tguh.cpt and attribute="accuracy" triggers the function hybrid.cpt. Warning: this can change in future versions of the package. Note that tguh.cpt and hybrid.cpt return the same number of change-points and the only difference lies in their estimated locations.

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

tguh.cpt, hybrid.cpt, wbs.cpt

Examples

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

[Package breakfast version 1.0.0 Index]