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

coef.bvar

Coefficient and VCOV methods for Bayesian VARs


Description

Retrieves coefficient / variance-covariance values from Bayesian VAR models generated with bvar. Note that coefficients are available for every stored draw and one may retrieve (a) credible intervals via the conf_bands argument, or (2) means via the type argument.

Usage

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

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

Arguments

object

A bvar object, obtained from bvar.

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.

companion

Logical scalar. Whether to retrieve the companion matrix of coefficients. See companion.bvar.

...

Not used.

Value

Returns a numeric array of class bvar_coefs or bvar_vcovs at the specified values.

See Also

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 coefficent values at the 10%, 50% and 90% quantiles
coef(x, conf_bands = 0.10)

# Only get the median of the variance-covariance matrix
vcov(x, conf_bands = 0.5)

BVAR

Hierarchical Bayesian Vector Autoregression

v1.0.1
GPL-3 | file LICENSE
Authors
Nikolas Kuschnig [aut, cre] (<https://orcid.org/0000-0002-6642-2543>), Lukas Vashold [aut] (<https://orcid.org/0000-0002-3562-3414>), Michael McCracken [dtc], Serena Ng [dtc]
Initial release
2020-09-26

We don't support your browser anymore

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