bsvars-package {bsvars} | R Documentation |
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>.
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:
homoskedastic model with unit variances
heteroskedastic model with stationary Markov switching in the variances
heteroskedastic model with Stochastic Volatility process for variances
non-normal model with a finite mixture of normal components and component-specific variances
heteroskedastic model with sparse Markov switching in the variances where the number of heteroskedastic components is estimated
non-normal model with a sparse mixture of normal components and component-specific variances where the number of heteroskedastic components is estimated
This package is currently in active development. Your comments, suggestions and requests are warmly welcome!
Tomasz Woźniak wozniak.tom@pm.me
Woźniak, T., and Droumaguet, M., (2022) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs.
# upload data
data(us_fiscal_lsuw)
# specify the model and set seed
specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4)
set.seed(123)
# run the burn-in
burn_in = estimate_bsvar_sv(10, specification)
# estimate the model
posterior = estimate_bsvar_sv(50, burn_in$get_last_draw())
# normalise the posterior
BB = posterior$last_draw$starting_values$B # get the last draw of B
B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements
bsvars::normalise_posterior(posterior, B_hat) # draws in posterior are normalised