The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
An R package for Bayesian Estimation of Structural Vector Autoregressions Identified by Sign, Zero, and Narrative Restrictions
Implements state-of-the-art algorithms for the Bayesian analysis of Structural Vector Autoregressions identified by sign, zero, and narrative restrictions. The core model is based on a flexible Vector Autoregression with estimated hyper-parameters of the Minnesota prior and the dummy observation priors as in Giannone, Lenza, Primiceri (2015). The sign restrictions are implemented employing the methods proposed by Rubio-Ramírez, Waggoner & Zha (2010), while identification through sign and zero restrictions follows the approach developed by Arias, Rubio-Ramírez, & Waggoner (2018). Furthermore, our tool provides algorithms for identification via sign and narrative restrictions, in line with the methods introduced by Antolín-Díaz and Rubio-Ramírez (2018). Users can also estimate a model with sign, zero, and narrative restrictions imposed at once. The package facilitates predictive and structural analyses using impulse responses, forecast error variance and historical decompositions, forecasting and conditional forecasting, as well as analyses of structural shocks and fitted values. All this is complemented by colourful plots, user-friendly summary functions, and comprehensive documentation. The bsvarSIGNs package is aligned regarding objects, workflows, and code structure with the R package bsvars by Woźniak (2024), and they constitute an integrated toolset.
A
and error terms E
, and the structural
equation with a structural matrix B
and shocks
U
Y = AX + E (VAR equation)
BE = U (structural equation)
specify_bsvarSIGN$new()
functionestimate()
methodforecast()
methodcompute_impulse_responses()
,
compute_variance_decompositions()
,
compute_historical_decompositions()
, and
compute_structural_shocks()
respectivelycompute_fitted_values()
and
compute_conditional_sd()
respectivelyplot()
and summary()
methods to gain
the insights into the core of the empirical problem.**************************************************|
bsvarSIGNs: Bayesian Structural VAR with sign, |
zero and narrative restrictions |
**************************************************|
Progress of simulation for 1000 independent draws
Press Esc to interrupt the computations
**************************************************|
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
***********************************
This beautiful logo can be reproduced in R using this file.
Replication of the results by Arias, Rubio-Ramírez, & Waggoner (2018).
# investigate the effects of the optimism shock
data(optimism)
# specify identifying restrictions:
# + no effect on productivity (zero restriction)
# + positive effect on stock prices (positive sign restriction)
= matrix(c(0, 1, rep(NA, 23)), 5, 5)
sign_irf
# specify the model
= specify_bsvarSIGN$new(optimism * 100,
specification p = 4,
sign_irf = sign_irf)
# estimate the model
= estimate(specification, S = 100)
posterior
# compute and plot impulse responses
= compute_impulse_responses(posterior, horizon = 40)
irf plot(irf, probability = 0.68)
Replication of the results by Antolín-Díaz and Rubio-Ramírez (2018).
# investigate the effects of the contractionary monetary policy shock
data(monetary)
# specify identifying restrictions:
# + sign restrictions on the impulse responses at horizons from 0 to 5
= matrix(NA, 6, 6)
sign_irf 1] = c(NA, -1, -1, NA, -1, 1)
sign_irf[, = array(sign_irf, dim = c(6, 6, 6))
sign_irf
# + narrative sign restriction: the shock is positive in October 1979
= list(
sign_narrative specify_narrative(start = 166, periods = 1, type = "S", sign = 1, shock = 1),
specify_narrative(start = 166, periods = 1, type = "B", sign = 1, shock = 1, var = 6)
)
# specify the model
= specify_bsvarSIGN$new(monetary * 100,
specification p = 12,
sign_irf = sign_irf,
sign_narrative = sign_narrative)
# estimate the model
= estimate(specification, S = 100)
posterior
# compute and plot impulse responses
= compute_impulse_responses(posterior, horizon = 60)
irf plot(irf, probability = 0.68)
You must have a cpp compiler. Follow the instructions from Section 1.3. by Eddelbuettel & François (2023). In short, for Windows: install RTools, for macOS: install Xcode Command Line Tools, and for Linux: install the standard development packages.
Just open your R and type:
install.packages("bsvarSIGNs")
The developer’s version of the package with the newest features can be installed by typing:
devtools::install_github("bsvars/bsvarSIGNs")
The package is under intensive development. Your help is most welcome! Please, have a look at the roadmap and report a bug. Thank you!
Xiaolei is a PhD candidate at the University of Melbourne. He is interested in Bayesian econometrics and time series analysis and is the author and maintainer of the bsvarSIGNs package.
Tomasz is a Bayesian econometrician and a Senior Lecturer at the University of Melbourne. He develops methodology for empirical macroeconomic analyses and programs in R and cpp using Rcpp.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.