Learn R Programming

BVAR (version 0.2.0)

companion.bvar: Retrieve companion matrix from a Bayesian VAR

Description

Calculates the companion matrix for Bayesian VARs generated via bvar.

Usage

# S3 method for bvar
companion(object, conf_bands = 0.5, complete = FALSE,
  ...)

companion(object, ...)

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 included as a default.

complete

Logical value. Whether to retrieve the companion matrix for all saved draws of the VAR coefficients. Overrides conf_bands if set TRUE.

...

Not used.

Value

Returns a numeric array/matrix of class bvar_comp containing the companion matrix of the VAR's coefficients 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 companion matrices for confidence bands at to 10%, 50% and 90%
companion(x, conf_bands = 0.10, complete = FALSE)

# Get companion matrices for all draws of the VAR coefficients
companion(x, complete = TRUE)
# }

Run the code above in your browser using DataLab