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

View source: R/94_logLik.R

WAIC.bvarR Documentation

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 class 'bvar'
WAIC(x, n_thin = 1L, ...)

WAIC(x, ...)

## Default S3 method:
WAIC(x, ...)

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.

Value

Returns a numerical value.

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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v100.i14")}.

See Also

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 = 600L, n_burn = 100L, verbose = FALSE)

# Calculate the log-likelihood
WAIC(x)


BVAR documentation built on May 29, 2024, 5:34 a.m.