Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

residuals.dlmFiltered

One-step forecast errors


Description

The function computes one-step forecast errors for a filtered dynamic linear model.

Usage

## S3 method for class 'dlmFiltered'
residuals(object, ..., type = c("standardized", "raw"), sd = TRUE)

Arguments

object

an object of class "dlmFiltered", such as the output from dlmFilter

...

unused additional arguments.

type

should standardized or raw forecast errors be produced?

sd

when sd = TRUE, standard deviations are returned as well.

Value

A vector or matrix (in the multivariate case) of one-step forecast errors, standardized if type = "standardized". Time series attributes of the original observation vector (matrix) are retained by the one-step forecast errors.

If sd = TRUE then the returned value is a list with the one-step forecast errors in component res and the corresponding standard deviations in component sd.

Note

The object argument must include a component y containing the data. This component will not be present if object was obtained by calling dlmFilter with simplify = TRUE.

Author(s)

Giovanni Petris GPetris@uark.edu

References

Giovanni Petris (2010), An R Package for Dynamic Linear Models. Journal of Statistical Software, 36(12), 1-16. http://www.jstatsoft.org/v36/i12/.
Petris, Petrone, and Campagnoli, Dynamic Linear Models with R, Springer (2009).
West and Harrison, Bayesian forecasting and dynamic models (2nd ed.), Springer (1997).

See Also

Examples

## diagnostic plots 
nileMod <- dlmModPoly(1, dV = 15100, dW = 1468)
nileFilt <- dlmFilter(Nile, nileMod)
res <- residuals(nileFilt, sd=FALSE)
qqnorm(res)
tsdiag(nileFilt)

dlm

Bayesian and Likelihood Analysis of Dynamic Linear Models

v1.1-5
GPL (>= 2)
Authors
Giovanni Petris [aut, cre], Wally Gilks [ctb] (Author of original C code for ARMS)
Initial release
2018-05-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.