Estimation of Bayesian vectorautoregressions with/without stochastic volatility.
Implements several modern hierarchical shrinkage priors, 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.
Install CRAN version:
install.packages("bayesianVARs")
Install latest development version directly from GitHub:
::install_github("luisgruber/bayesianVARs") devtools
The main workhorse to conduct Bayesian inference for
vectorautoregression models in this package is the function
bvar()
.
Some features:
predict()
, plot()
, coef()
,
vcov()
and fitted()
.specify_prior_phi()
and
specify_prior_sigma()
.set.seed(537)
# load package
library(bayesianVARs)
# Load data
<-100 * usmacro_growth[1:237,c("GDPC1", "PCECC96", "GPDIC1", "AWHMAN", "GDPCTPI", "CES2000000008x", "FEDFUNDS", "GS10", "EXUSUKx", "S&P 500")]
train_data <-100 * usmacro_growth[238:241,c("GDPC1", "PCECC96", "GPDIC1", "AWHMAN", "GDPCTPI", "CES2000000008x", "FEDFUNDS", "GS10", "EXUSUKx", "S&P 500")]
test_data
# Estimate model using default prior settings
<- bvar(train_data, lags = 2L, draws = 2000, burnin = 1000, sv_keep = "all")
mod
# Out of sample prediction and log-predictive-likelihood evaluation
<- predict(mod, ahead = 1:4, LPL = TRUE, Y_obs = test_data)
pred
# Visualize in-sample fit plus out-of-sample prediction intervals
plot(mod, predictions = pred)
bayesianVARs - Shrinkage Priors for Bayesian Vectorautoregressions in R