Learn R Programming

BVAR (version 1.0.5)

WAIC.bvar: Widely applicable information criterion (WAIC) for Bayesian VARs

Description

Calculates the widely applicable (or Watanabe-Akaike) information criterion (Watanabe, 2010) for VAR models generated with bvar. The result equals $$-2 (\text{lppd} - \text{pWAIC}$$, where 'lppd' is the log pointwise predictive density, and 'pWAIC' is the effective number of parameters.

Usage

# S3 method for bvar
WAIC(x, n_thin = 1L, ...)

WAIC(x, ...)

# S3 method for default WAIC(x, ...)

Value

Returns a numerical value.

Arguments

x

A bvar object, obtained from bvar.

n_thin

Integer scalar. Every n_thin'th draw in x is used to calculate, others are dropped.

...

Not used.

References

Watanabe, S. (2010) Asymptotic Equivalence of Bayes Cross Validation and Widely Applicable Information Criterion in Singular Learning Theory. Journal of Machine Learning Research, 11, 3571-3594.

Kuschnig, N. and Vashold, L. (2021) BVAR: Bayesian Vector Autoregressions with Hierarchical Prior Selection in R. Journal of Statistical Software, 14, 1-27, tools:::Rd_expr_doi("10.18637/jss.v100.i14").

See Also

bvar

Examples

Run this code
# \donttest{
# 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 = 600L, n_burn = 100L, verbose = FALSE)

# Calculate the log-likelihood
WAIC(x)
# }

Run the code above in your browser using DataLab