Learn R Programming

BVAR (version 0.2.2)

fitted.bvar: Fitted and residual methods for Bayesian VARs

Description

Calculates fitted values / residuals for Bayesian VARs generated with bvar.

Usage

# S3 method for bvar
fitted(object, conf_bands = 0.5, ...)

# S3 method for bvar residuals(object, conf_bands = 0.5, ...)

# S3 method for bvar_resid plot(x, vars = NULL, mar = c(2, 2, 2, 0.5), ...)

# S3 method for bvar_fitted print(x, digits = 2L, ...)

# S3 method for bvar_resid print(x, digits = 2L, ...)

Arguments

object

A bvar object, obtained from bvar.

conf_bands

Numeric vector of desired confidence bands to apply. E.g. for bands at 5%, 10%, 90% and 95% set this to c(0.05, 0.1). Note that the median, i.e. 0.5 is always included.

...

Graphical parameters for par.

x

Object of class bvar_fitted / bvar_resid.

vars

Optional numeric vector. Used to subset the plot to certain variables by position. Defaults to NULL, i.e. all variables.

mar

Numeric vector. Margins for par.

digits

Integer scalar. Fed to round and applied to numeric outputs (i.e. the quantiles).

Value

Returns a numeric array of class bvar_fitted / bvar_resid with desired values at the specified confidence bands.

See Also

bvar

Examples

Run this code
# NOT RUN {
data <- matrix(rnorm(200), ncol = 2)
x <- bvar(data, lags = 2)

# Get fitted values and adjust confidence bands to 10%, 50% and 90%
fitted(x, conf_bands = 0.10)

# Get residuals
residuals(x)
# }

Run the code above in your browser using DataLab