| predict.not | R Documentation |
Estimates signal in object$x with change-points at cpt. The type of the signal depends on
on the value of contrast that has been passed to not (see details below).
## S3 method for class 'not'
predict(object, cpt, ...)
object |
An object of class 'not', returned by |
cpt |
An integer vector with locations of the change-points.
If missing, the |
... |
Further parameters that can be passed to |
The data points provided in object$x are assumed to follow
Y_{t} = f_{t}+\sigma_{t}\varepsilon_{t},
for t=1,\ldots,n, where n is the number of observations in object$x, the signal f_{t} and the standard deviation \sigma_{t}
are non-stochastic with change-points at locations given in cpt and \varepsilon_{t} is a white-noise. Denote by \tau_{1}, \ldots, \tau_{q}
the elements in cpt and set \tau_{0}=0 and \tau_{q+1}=T. Depending on the value of contrast that has been passed to not to construct object, the returned value is calculated as follows.
For contrast="pcwsConstantMean" and contrast="pcwsConstantMeanHT", in each segment (\tau_{j}+1, \tau_{j+1}),
f_{t} for t\in(\tau_{j}+1, \tau_{j+1}) is approximated by the mean of Y_{t} calculated over t\in(\tau_{j}+1, \tau_{j+1}).
For contrast="pcwsLinContMean", f_{t} is approximated by the linear spline fit with knots at \tau_{1}, \ldots, \tau_{q} minimising the l2 distance between the fit and the data.
For contrast="pcwsLinMean" in each segment (\tau_{j}+1, \tau_{j+1}), the signal
f_{t} for t\in(\tau_{j}+1, \tau_{j+1}) is approximated by the line \alpha_{j} + \beta_{j} t, where the regression coefficients are
found using the least squares method.
For contrast="pcwsQuad", the signal
f_{t} for t\in(\tau_{j}+1, \tau_{j+1}) is approximated by the curve \alpha_{j} + \beta_{j} t + \gamma_{j} t^2, where the regression coefficients are
found using the least squares method.
For contrast="pcwsConstMeanVar", in each segment (\tau_{j}+1, \tau_{j+1}),
f_{t} and \sigma_{t} for t\in(\tau_{j}+1, \tau_{j+1}) are approximated by, respectively, the mean and the standard deviation of Y_{t}, both calculated over t\in(\tau_{j}+1, \tau_{j+1}).
A vector wit the estimated signal or a two-column matrix with the estimated estimated signal and standard deviation if contrast="pcwsConstMeanVar" was used to construct object.
not
# **** 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")
# *** when 'cpt' is omitted, 'features' function is used internally
# to choose change-points locations
signal.est <- predict(w)
# *** estimate the signal specifying the location of the change-point
signal.est.known.cpt <- predict(w, cpt=100)
# *** pass arguments of the 'features' function through 'predict'.
signal.est.aic <- predict(w, penalty.type="aic")
# **** Piecewisce-constant mean and variance with Gaussian noise.
x <- c(rep(0, 100), rep(1,100)) + c(rep(2, 100), rep(1,100)) * rnorm(100)
# *** identify potential locations of the change-points
w <- not(x, contrast = "pcwsConstMeanVar")
# *** here signal is two-dimensional
signal.est <- predict(w)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.