residuals.not {not} | R Documentation |
Extract residuals from a 'not' object
Description
Returns a difference between x
in object
and the estimated signal with change-points at cpt
.
Type of the signal depends on the value of contrast
that has been passed to not
in order to construct object
(see details of predict.not
).
Usage
## S3 method for class 'not'
residuals(object, cpt, type = c("raw", "standardised"),
...)
Arguments
object |
An object of class 'not', returned by |
cpt |
An integer vector with locations of the change-points.
If missing, the |
type |
Choice of "raw" and "standardised". |
... |
Further parameters that can be passed to |
Value
If type="raw"
, the difference between the data and the estimated signal. If type="standardised"
, the difference between the data and the estimated signal, divided by the estimated standard deviation.
Examples
pcws.const.sig <- c(rep(0, 100), rep(1,100))
x <- pcws.const.sig + rnorm(100)
w <- not(x, contrast = "pcwsConstMean")
# *** plot residuals obtained via fitting piecewise-constant function with estimated change-points
plot(residuals(w))
# *** plot residuals with obtained via fitting piecewise-constant function with true change-point
plot(residuals(w, cpt=100))
# *** plot standardised residuals
plot(residuals(w, type="standardised"))
[Package not version 1.5 Index]