companion: Retrieve companion matrix from a Bayesian VAR

View source: R/97_companion.R

companionR Documentation

Retrieve companion matrix from a Bayesian VAR

Description

Calculates the companion matrix for Bayesian VARs generated via bvar.

Usage

companion(object, ...)

## S3 method for class 'bvar'
companion(object, type = c("quantile", "mean"), conf_bands = 0.5, ...)

Arguments

object

A bvar object, obtained from bvar.

...

Not used.

type

Character scalar. Whether to return quantile or mean values. Note that conf_bands is ignored for mean values.

conf_bands

Numeric vector of 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.

Value

Returns a numeric array/matrix of class bvar_comp with the VAR's coefficents in companion form at the specified values.

See Also

bvar; coef.bvar

Examples


# Access a subset of the fred_qd dataset
data <- fred_qd[, c("CPIAUCSL", "UNRATE", "FEDFUNDS")]
# Transform it to be stationary
data <- fred_transform(data, codes = c(5, 5, 1), lag = 4)

# Estimate a BVAR using one lag, default settings and very few draws
x <- bvar(data, lags = 1, n_draw = 1000L, n_burn = 200L, verbose = FALSE)

# Get companion matrices for confidence bands at 10%, 50% and 90%
companion(x, conf_bands = 0.10)


BVAR documentation built on March 31, 2023, 11:59 p.m.