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,...,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, ..., 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, ..., 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 j, 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 j + gamma_j^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.