Learn R Programming

bayesianVARs (version 0.1.8)

residuals.bayesianVARs_bvar: Extract Model Residuals

Description

Extract model residuals, defined as the difference between the observed time-series and the in-sample predictions of the VAR model. Because in-sample prediction is subject to uncertainty of the VAR parameter estimates, this uncertainty carries over to the model residuals.

Usage

# S3 method for bayesianVARs_bvar
residuals(object, ...)

Value

An object of class bayesianVARs_residuals.

Arguments

object

A bayesianVARs_bvar object estimated via bvar().

...

Passed to fitted.bayesianVARs_bvar().

See Also

fitted.bayesianVARs_bvar

Examples

Run this code
# Access a subset of the usmacro_growth dataset
data <- usmacro_growth[,c("GDPC1", "CPIAUCSL", "FEDFUNDS")]

# Estimate a model
mod <- bvar(data, sv_keep = "all", quiet = TRUE)

mod.resids <- residuals(mod)
plot(mod.resids)

Run the code above in your browser using DataLab