residuals: Model Residuals

residuals.tsissm.estimateR Documentation

Model Residuals

Description

Extract the residual values from an estimated model.

Usage

## S3 method for class 'tsissm.estimate'
residuals(
  object,
  raw = FALSE,
  h = 1,
  seed = NULL,
  trace = FALSE,
  index_start = 1,
  ...
)

Arguments

object

an object of class “tsissm.estimate”.

raw

raw residuals are the model based values in transformed space (when either Box Cox or Logistic have been used as transformatiions).

h

the horizon (steps) ahead residuals required. The default represents the standard residuals whilst for h>1 these are the (1:h)-step ahead in-sample predicted residuals for each time point under fixed coefficients.

seed

a seed value which initializes the simulated predictive distribution from which the h-step ahead forecasts are made in order to calculate the residuals.

trace

whether to show the progress bar for the h-step ahead residuals calculation. The user is expected to have set up appropriate handlers for this using the “progressr” package.

index_start

the numeric index of the series from which to start the evaluation (defaults to the first data point). For very large series, one may be interested in discarding earlier periods.

...

not currently used.

Details

For h>1, this is like performing an in-sample backtest starting at time 1 with fixed coefficients. The purpose of having the matrix of h-step ahead residuals is in order to calculate the 1:h covariance matrix as well as the cross 1:h covariance matrix when ensembling series at multiple horizons.

Value

An xts vector of the model residuals for h = 1, else a data.table with rows representing the first prediction date and columns the h-ahead forecast residuals.

Note

The function can use parallel functionality (for h>1) as long as the user has set up a plan using the future package.


tsmodels/tsissm documentation built on June 22, 2022, 6:57 a.m.