segment.mean {breakfast} | R Documentation |
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.
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))
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 |
sigma |
The same as the corresponding parameter in |
th.const |
The same as the corresponding parameter in |
p |
The same as the corresponding parameter in |
minseglen |
The same as the corresponding parameter in |
bal |
The same as the corresponding parameter in |
num.zero |
The same as the corresponding parameter in |
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.
A list with the following components:
est |
The estimated piecewise-constant mean of |
no.of.cpt |
The estimated number of change-points in the piecewise-constant mean of |
cpt |
The estimated locations of change-points in the piecewise-contant mean of |
Piotr Fryzlewicz, p.fryzlewicz@lse.ac.uk
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