residuals.not: Extract residuals from a 'not' object

View source: R/residuals.R

residuals.notR 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 not.

cpt

An integer vector with locations of the change-points. If missing, the features is called internally to extract the change-points from object.

type

Choice of "raw" and "standardised".

...

Further parameters that can be passed to predict.not and features.

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"))

not documentation built on March 18, 2022, 7:24 p.m.