bsvars-package {bsvars}R Documentation

Bayesian Estimation of Structural Vector Autoregressive Models

Description

Efficient and fast algorithms for Bayesian estimation of Structural Vector Autoregressive (SVAR) models via Markov chain Monte Carlo methods. A wide range of SVAR models is considered, including homo- and heteroskedastic specifications and those with non-normal structural shocks. The heteroskedastic SVAR model setup is similar as in Woźniak & Droumaguet (2015) <doi:10.13140/RG.2.2.19492.55687> and Lütkepohl & Woźniak (2020) <doi:10.1016/j.jedc.2020.103862>. The sampler of the structural matrix follows Waggoner & Zha (2003) ,doi:10.1016/S0165-1889(02)00168-9>, whereas that for autoregressive parameters follows Chan, Koop, Yu (2022) <https://www.joshuachan.org/papers/OISV.pdf>. The specification of Markov switching heteroskedasticity is inspired by Song & Woźniak (2021) <doi:10.1093/acrefore/9780190625979.013.174>, and that of Stochastic Volatility model by Kastner & Frühwirth-Schnatter (2014) <doi:10.1016/j.csda.2013.01.002>.

Details

All the SVAR models in this package are specified by two equations, including the reduced form equation:

Y = AX + E

where Y is an NxT matrix of dependent variables, X is a KxT matrix of explanatory variables, E is an NxT matrix of reduced form error terms, and A is an NxK matrix of autoregressive slope coefficients and parameters on deterministic terms in X.

The structural equation is given by:

BE = U

where U is an NxT matrix of structural form error terms, and B is an NxN matrix of contemporaneous relationships.

Finally, all of the models share the following assumptions regarding the structural shocks U, namely, joint conditional normality given the past observations collected in matrix X, and temporal and contemporaneous independence. The latter implies zero correlations and autocorrelations.

The various SVAR models estimated differ by the specification of structural shocks variances. The different models include:

Note

This package is currently in active development. Your comments, suggestions and requests are warmly welcome!

Author(s)

Tomasz Woźniak wozniak.tom@pm.me

References

Woźniak, T., and Droumaguet, M., (2022) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs.

Examples

# upload data
data(us_fiscal_lsuw)    # upload dependent variables
data(us_fiscal_ex)      # upload exogenous variables

# specify the model and set seed
specification  = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4, exogenous = us_fiscal_ex)
set.seed(123)

# run the burn-in
burn_in        = estimate(specification, 10)

# estimate the model
posterior      = estimate(burn_in, 10, thin = 2)

# compute impulse responses 2 years ahead
irf           = compute_impulse_responses(posterior, horizon = 8)

# compute forecast error variance decomposition 2 years ahead
fevd           = compute_variance_decompositions(posterior, horizon = 8)

# workflow with the pipe |>
############################################################
set.seed(123)
us_fiscal_lsuw |>
  specify_bsvar_sv$new(p = 4, exogenous = us_fiscal_ex) |>
  estimate(S = 10) |> 
  estimate(S = 20) |> 
  compute_variance_decompositions(horizon = 8) -> fevds


[Package bsvars version 2.1.0 Index]