MCMC Estimation of Bayesian Vectorautoregressions

Efficient Markov Chain Monte Carlo (MCMC) algorithms for the fully Bayesian estimation of vectorautoregressions (VARs) featuring stochastic volatility (SV). Implements state-of-the-art shrinkage priors following Gruber & Kastner (2025) . Efficient equation-per-equation estimation following Kastner & Huber (2020) and Carrerio et al. (2021) .


bayesianVARs

R-CMD-check CRANstatus

Estimation of Bayesian vectorautoregressions with/without stochastic volatility.

Implements several modern hierarchical shrinkage priors and their semi-global refinements allowing for structured shrinkage. Amongst them Dirichlet-Laplace prior (DL), hierarchical Minnesota prior (HM), Horseshoe prior (HS), normal-gamma prior (NG), $R^2$-induced-Dirichlet-decomposition prior (R2D2) and stochastic search variable selection prior (SSVS).

Concerning the error-term, the user can either specify an order-invariant factor structure or an order-variant cholesky structure.

Installation

Install CRAN version:

install.packages("bayesianVARs")

Install latest development version directly from GitHub:

devtools::install_github("luisgruber/bayesianVARs")

Usage

The main workhorse to conduct Bayesian inference for vectorautoregression models in this package is the function bvar().

Some features:

  • Prediction, plotting, extraction of model parameters and extraction of fitted values with the usual generic functions predict(), plot(), coef(), vcov() and fitted().
  • Configure prior distributions with helper functions specify_prior_phi() and specify_prior_sigma().
  • Computation and simulation of impulse response functions withirf() and specification of structural restrictions with helper function specify_structural_restrictions().

Demonstration

set.seed(537)
# load package
library(bayesianVARs)

# Load data
train_data <-100 * usmacro_growth[1:237,c("GDPC1", "PCECC96", "GPDIC1", "AWHMAN", "GDPCTPI", "CES2000000008x", "FEDFUNDS", "GS10", "EXUSUKx", "S&P 500")]
test_data <-100 * usmacro_growth[238:241,c("GDPC1", "PCECC96", "GPDIC1", "AWHMAN", "GDPCTPI", "CES2000000008x", "FEDFUNDS", "GS10", "EXUSUKx", "S&P 500")]
                                   
# Estimate model using default prior settings
mod <- bvar(train_data, lags = 2L, draws = 2000, burnin = 1000, sv_keep = "all")

# Out of sample prediction and log-predictive-likelihood evaluation
pred <- predict(mod, ahead = 1:4, LPL = TRUE, Y_obs = test_data)

# Visualize in-sample fit plus out-of-sample prediction intervals
plot(mod, predictions = pred)

Documentation

browseVignettes(package = "bayesianVARs")
# If installing directly from GitHub, one has to explicitely request vignettes, e.g. with
# devtools::install_github("luisgruber/bayesianVARs", dependencies = TRUE, build_vignettes = TRUE)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("bayesianVARs")

0.1.8 by Luis Gruber, 8 months ago


https://github.com/luisgruber/bayesianVARs, https://luisgruber.github.io/bayesianVARs/


Report a bug at https://github.com/luisgruber/bayesianVARs/issues


Browse source code at https://github.com/cran/bayesianVARs


Authors: Luis Gruber [cph, aut, cre] (ORCID: , Stefan Haan [aut] , Gregor Kastner [aut, ths] (ORCID:


Documentation:   PDF Manual  


GPL (>= 3) license


Imports colorspace, factorstochvol, GIGrvg, graphics, MASS, mvtnorm, Rcpp, scales, stats, stochvol, utils

Suggests coda, knitr, quarto, rmarkdown, testthat, lpSolveAPI, bsvarSIGNs

Linking to factorstochvol, Rcpp, RcppArmadillo, RcppProgress, stochvol, lpSolveAPI


See at CRAN