Package: bsvars 4.0

Tomasz Woźniak

bsvars: Bayesian Estimation of Structural Vector Autoregressive Models

Provides fast and efficient procedures for Bayesian analysis of Structural Vector Autoregressions. This package estimates a wide range of models, including homo-, heteroskedastic, and non-normal specifications. Structural models can be identified by adjustable exclusion restrictions, time-varying volatility, or non-normality, and include exclusion restrictions on autoregressive parameters. They all include a flexible three-level equation-specific local-global hierarchical prior distribution for the estimated level of shrinkage for autoregressive and structural parameters. Additionally, the package facilitates predictive and structural analyses such as impulse responses, forecast error variance and historical decompositions, forecasting, verification of heteroskedasticity, non-normality, and hypotheses on autoregressive parameters, as well as analyses of structural shocks, volatilities, and fitted values. Beautiful plots, informative summary functions, and extensive documentation including the vignette by Woźniak (2025) <doi:10.48550/arXiv.2410.15090> complement all this. The implemented techniques align closely with those presented in Lütkepohl, Shang, Uzeda, & Woźniak (2025) <doi:10.1016/j.jeconom.2025.106107>, Lütkepohl & Woźniak (2020) <doi:10.1016/j.jedc.2020.103862>, and Song & Woźniak (2021) <doi:10.1093/acrefore/9780190625979.013.174>. The 'bsvars' package is aligned regarding objects, workflows, and code structure with the R package 'bsvarSIGNs' by Wang & Woźniak (2024) <doi:10.32614/CRAN.package.bsvarSIGNs>, and they constitute an integrated toolset.

Authors:Tomasz Woźniak [aut, cre], Xiaolei Wang [ctb], Bruno Cavalcante [ctb]

bsvars_4.0.tar.gz
bsvars_4.0.zip(r-4.7)bsvars_4.0.zip(r-4.6)bsvars_4.0.zip(r-4.5)
bsvars_4.0.tgz(r-4.6-x86_64)bsvars_4.0.tgz(r-4.6-arm64)bsvars_4.0.tgz(r-4.5-x86_64)bsvars_4.0.tgz(r-4.5-arm64)
bsvars_4.0.tar.gz(r-4.7-arm64)bsvars_4.0.tar.gz(r-4.7-x86_64)bsvars_4.0.tar.gz(r-4.6-arm64)bsvars_4.0.tar.gz(r-4.6-x86_64)
bsvars_4.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
bsvars/json (API)
NEWS

# Install 'bsvars' in R:
install.packages('bsvars', repos = c('https://bsvars.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/bsvars/bsvars/issues

Pkgdown/docs site:https://bsvars.org

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library
Datasets:
  • us_fiscal_cond_forecasts - A matrix to be used in a conditional forecasting example including the projected values of total tax revenue that are projected to increase at an average quarterly sample growth rate. The other two columns are filled with 'NA' values, which implies that the future values of the corresponding endogenous variables, namely government spending and GDP, will be forecasted given the provided projected values of total tax revenue. The matrix includes future values for the forecast horizon of two years for the US fiscal model for the period 2024 Q3 - 2026 Q1.
  • us_fiscal_ex - A 3-variable system of exogenous variables for the US fiscal model for the period 1948 Q1 - 2026 Q1
  • us_fiscal_ex_forecasts - A 3-variable system of exogenous variables' future values for the forecast horizon of two years for the US fiscal model for the period 2026 Q2 - 2028 Q1
  • us_fiscal_lsuw - A 3-variable US fiscal system for the period 1948 Q1 - 2026 Q1

On CRAN:

Conda:

bayesian-inferenceeconometricsvector-autoregressionopenblascppopenmp

8.84 score 62 stars 3 packages 124 scripts 902 downloads 43 exports 10 dependencies

Last updated from:2c0a8cebdb. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK263
linux-devel-x86_64OK238
source / vignettesOK373
linux-release-arm64OK271
linux-release-x86_64OK244
macos-release-arm64OK280
macos-release-x86_64OK546
macos-oldrel-arm64OK321
macos-oldrel-x86_64OK371
windows-develOK394
windows-releaseOK393
windows-oldrelOK355
wasm-releaseOK190

Exports:compute_conditional_sdcompute_fitted_valuescompute_historical_decompositionscompute_impulse_responsescompute_regime_probabilitiescompute_structural_shockscompute_variance_decompositionsestimateforecastnormaliseplot_ribbonspecify_bsvarspecify_bsvar_exhspecify_bsvar_hmshspecify_bsvar_mixspecify_bsvar_mshspecify_bsvar_svspecify_bsvar_tspecify_data_matricesspecify_identification_bsvarsspecify_posterior_bsvarspecify_posterior_bsvar_exhspecify_posterior_bsvar_hmshspecify_posterior_bsvar_mixspecify_posterior_bsvar_mshspecify_posterior_bsvar_svspecify_posterior_bsvar_tspecify_prior_bsvarspecify_prior_bsvar_exhspecify_prior_bsvar_mixspecify_prior_bsvar_mshspecify_prior_bsvar_svspecify_prior_bsvar_tspecify_starting_values_bsvarspecify_starting_values_bsvar_exhspecify_starting_values_bsvar_hmshspecify_starting_values_bsvar_mixspecify_starting_values_bsvar_mshspecify_starting_values_bsvar_svverify_autoregressionverify_identificationverify_normalityverify_volatility

Dependencies:codagenericsGIGrvglatticeR6RcppRcppArmadilloRcppProgressRcppTNstochvol

Fast and Efficient Bayesian Analysis of Structural Vector Autoregressions Using the R package bsvars

Rendered frombsvars_vignette.Rnwusingknitr::knitron Jun 09 2026.

Last update: 2024-10-19
Started: 2024-10-19

Readme and manuals

Help Manual

Help pageTopics
Bayesian Estimation of Structural Vector Autoregressive Modelsbsvars-package bsvars
Computes posterior draws of structural shock conditional standard deviationscompute_conditional_sd
Computes posterior draws of structural shock conditional standard deviationscompute_conditional_sd.PosteriorBSVAR
Computes posterior draws of structural shock conditional standard deviationscompute_conditional_sd.PosteriorBSVAREXH
Computes posterior draws of structural shock conditional standard deviationscompute_conditional_sd.PosteriorBSVARHMSH
Computes posterior draws of structural shock conditional standard deviationscompute_conditional_sd.PosteriorBSVARMIX
Computes posterior draws of structural shock conditional standard deviationscompute_conditional_sd.PosteriorBSVARMSH
Computes posterior draws of structural shock conditional standard deviationscompute_conditional_sd.PosteriorBSVARSV
Computes posterior draws of structural shock conditional standard deviationscompute_conditional_sd.PosteriorBSVART
Computes posterior draws from data predictive densitycompute_fitted_values
Computes posterior draws from data predictive densitycompute_fitted_values.PosteriorBSVAR
Computes posterior draws from data predictive densitycompute_fitted_values.PosteriorBSVAREXH
Computes posterior draws from data predictive densitycompute_fitted_values.PosteriorBSVARHMSH
Computes posterior draws from data predictive densitycompute_fitted_values.PosteriorBSVARMIX
Computes posterior draws from data predictive densitycompute_fitted_values.PosteriorBSVARMSH
Computes posterior draws from data predictive densitycompute_fitted_values.PosteriorBSVARSV
Computes posterior draws from data predictive densitycompute_fitted_values.PosteriorBSVART
Computes posterior draws of historical decompositionscompute_historical_decompositions
Computes posterior draws of historical decompositionscompute_historical_decompositions.PosteriorBSVAR
Computes posterior draws of historical decompositionscompute_historical_decompositions.PosteriorBSVAREXH
Computes posterior draws of historical decompositionscompute_historical_decompositions.PosteriorBSVARHMSH
Computes posterior draws of historical decompositionscompute_historical_decompositions.PosteriorBSVARMIX
Computes posterior draws of historical decompositionscompute_historical_decompositions.PosteriorBSVARMSH
Computes posterior draws of historical decompositionscompute_historical_decompositions.PosteriorBSVARSV
Computes posterior draws of historical decompositionscompute_historical_decompositions.PosteriorBSVART
Computes posterior draws of impulse responsescompute_impulse_responses
Computes posterior draws of impulse responsescompute_impulse_responses.PosteriorBSVAR
Computes posterior draws of impulse responsescompute_impulse_responses.PosteriorBSVAREXH
Computes posterior draws of impulse responsescompute_impulse_responses.PosteriorBSVARHMSH
Computes posterior draws of impulse responsescompute_impulse_responses.PosteriorBSVARMIX
Computes posterior draws of impulse responsescompute_impulse_responses.PosteriorBSVARMSH
Computes posterior draws of impulse responsescompute_impulse_responses.PosteriorBSVARSV
Computes posterior draws of impulse responsescompute_impulse_responses.PosteriorBSVART
Computes posterior draws of regime probabilitiescompute_regime_probabilities
Computes posterior draws of regime probabilitiescompute_regime_probabilities.PosteriorBSVAREXH
Computes posterior draws of regime probabilitiescompute_regime_probabilities.PosteriorBSVARHMSH
Computes posterior draws of regime probabilitiescompute_regime_probabilities.PosteriorBSVARMIX
Computes posterior draws of regime probabilitiescompute_regime_probabilities.PosteriorBSVARMSH
Computes posterior draws of structural shockscompute_structural_shocks
Computes posterior draws of structural shockscompute_structural_shocks.PosteriorBSVAR
Computes posterior draws of structural shockscompute_structural_shocks.PosteriorBSVAREXH
Computes posterior draws of structural shockscompute_structural_shocks.PosteriorBSVARHMSH
Computes posterior draws of structural shockscompute_structural_shocks.PosteriorBSVARMIX
Computes posterior draws of structural shockscompute_structural_shocks.PosteriorBSVARMSH
Computes posterior draws of structural shockscompute_structural_shocks.PosteriorBSVARSV
Computes posterior draws of structural shockscompute_structural_shocks.PosteriorBSVART
Computes posterior draws of the forecast error variance decompositioncompute_variance_decompositions
Computes posterior draws of the forecast error variance decompositioncompute_variance_decompositions.PosteriorBSVAR
Computes posterior draws of the forecast error variance decompositioncompute_variance_decompositions.PosteriorBSVAREXH
Computes posterior draws of the forecast error variance decompositioncompute_variance_decompositions.PosteriorBSVARHMSH
Computes posterior draws of the forecast error variance decompositioncompute_variance_decompositions.PosteriorBSVARMIX
Computes posterior draws of the forecast error variance decompositioncompute_variance_decompositions.PosteriorBSVARMSH
Computes posterior draws of the forecast error variance decompositioncompute_variance_decompositions.PosteriorBSVARSV
Computes posterior draws of the forecast error variance decompositioncompute_variance_decompositions.PosteriorBSVART
Bayesian estimation of Structural Vector Autoregressions via Gibbs samplerestimate
Bayesian estimation of a homoskedastic Structural Vector Autoregression via Gibbs samplerestimate.BSVAR
Bayesian estimation of a Structural Vector Autoregression with exogenous heteroskedastic regime changes via Gibbs samplerestimate.BSVAREXH
Bayesian estimation of a Structural Vector Autoregression with Heterogeneous Markov-switching heteroskedasticity via Gibbs samplerestimate.BSVARHMSH
Bayesian estimation of a Structural Vector Autoregression with shocks following a finite mixture of normal components via Gibbs samplerestimate.BSVARMIX
Bayesian estimation of a Structural Vector Autoregression with Markov-switching heteroskedasticity via Gibbs samplerestimate.BSVARMSH
Bayesian estimation of a Structural Vector Autoregression with Stochastic Volatility heteroskedasticity via Gibbs samplerestimate.BSVARSV
Bayesian estimation of a homoskedastic Structural Vector Autoregression with t-distributed structural shocks via Gibbs samplerestimate.BSVART
Bayesian estimation of a homoskedastic Structural Vector Autoregression via Gibbs samplerestimate.PosteriorBSVAR
Bayesian estimation of a Structural Vector Autoregression with exogenous heteroskedastic regime changes via Gibbs samplerestimate.PosteriorBSVAREXH
Bayesian estimation of a Structural Vector Autoregression with Heterogeneous Markov-switching heteroskedasticity via Gibbs samplerestimate.PosteriorBSVARHMSH
Bayesian estimation of a Structural Vector Autoregression with shocks following a finite mixture of normal components via Gibbs samplerestimate.PosteriorBSVARMIX
Bayesian estimation of a Structural Vector Autoregression with Markov-switching heteroskedasticity via Gibbs samplerestimate.PosteriorBSVARMSH
Bayesian estimation of a Structural Vector Autoregression with Stochastic Volatility heteroskedasticity via Gibbs samplerestimate.PosteriorBSVARSV
Bayesian estimation of a homoskedastic Structural Vector Autoregression with t-distributed structural shocks via Gibbs samplerestimate.PosteriorBSVART
Forecasting using Bayesian Structural Vector Autoregressionforecast.PosteriorBSVAR
Forecasting using Bayesian Structural Vector Autoregressionforecast.PosteriorBSVAREXH
Forecasting using Bayesian Structural Vector Autoregressionforecast.PosteriorBSVARHMSH
Forecasting using Bayesian Structural Vector Autoregressionforecast.PosteriorBSVARMIX
Forecasting using Bayesian Structural Vector Autoregressionforecast.PosteriorBSVARMSH
Forecasting using Bayesian Structural Vector Autoregressionforecast.PosteriorBSVARSV
Forecasting using Bayesian Structural Vector Autoregressionforecast.PosteriorBSVART
Waggoner & Zha (2003) row signs normalisation of the posterior draws for the structural matrix Bnormalise
Waggoner & Zha (2003) row signs normalisation of the posterior draws for the structural matrix Bnormalise.PosteriorBSVAR
Waggoner & Zha (2003) row signs normalisation of the posterior draws for the structural matrix Bnormalise.PosteriorBSVAREXH
Waggoner & Zha (2003) row signs normalisation of the posterior draws for the structural matrix Bnormalise.PosteriorBSVARHMSH
Waggoner & Zha (2003) row signs normalisation of the posterior draws for the structural matrix Bnormalise.PosteriorBSVARMIX
Waggoner & Zha (2003) row signs normalisation of the posterior draws for the structural matrix Bnormalise.PosteriorBSVARMSH
Waggoner & Zha (2003) row signs normalisation of the posterior draws for the structural matrix Bnormalise.PosteriorBSVARSV
Waggoner & Zha (2003) row signs normalisation of the posterior draws for the structural matrix Bnormalise.PosteriorBSVART
Plots the median and an interval between two specified percentiles for a sequence of 'K' random variablesplot_ribbon
Plots fitted values of dependent variablesplot.Forecasts
Plots forecast error variance decompositionsplot.PosteriorFEVD
Plots fitted values of dependent variablesplot.PosteriorFitted
Plots historical decompositionsplot.PosteriorHD
Plots impulse responsesplot.PosteriorIR
Plots estimated regime probabilitiesplot.PosteriorRegimePr
Plots structural shocksplot.PosteriorShocks
Plots structural shocks' conditional standard deviationsplot.PosteriorSigma
R6 Class representing the specification of the homoskedastic BSVAR modelspecify_bsvar
R6 Class representing the specification of the BSVAREXH model with exogenous heteroskedastic regime change.specify_bsvar_exh
R6 Class representing the specification of the BSVARHMSH model with Heterogeneous Markov Switching Heteroskedasticity.specify_bsvar_hmsh
R6 Class representing the specification of the BSVAR model with a zero-mean mixture of normals model for structural shocks.specify_bsvar_mix
R6 Class representing the specification of the BSVAR model with Markov Switching Heteroskedasticity.specify_bsvar_msh
R6 Class representing the specification of the BSVAR model with Stochastic Volatility heteroskedasticity.specify_bsvar_sv
R6 Class representing the specification of the BSVAR model with t-distributed structural shocks.specify_bsvar_t
R6 Class Representing DataMatricesBSVARspecify_data_matrices
R6 Class Representing IdentificationBSVARsspecify_identification_bsvars
R6 Class Representing PosteriorBSVARspecify_posterior_bsvar
R6 Class Representing PosteriorBSVAREXHspecify_posterior_bsvar_exh
R6 Class Representing PosteriorBSVARHMSHspecify_posterior_bsvar_hmsh
R6 Class Representing PosteriorBSVARMIXspecify_posterior_bsvar_mix
R6 Class Representing PosteriorBSVARMSHspecify_posterior_bsvar_msh
R6 Class Representing PosteriorBSVARSVspecify_posterior_bsvar_sv
R6 Class Representing PosteriorBSVARTspecify_posterior_bsvar_t
R6 Class Representing PriorBSVARspecify_prior_bsvar
R6 Class Representing PriorBSVAREXHspecify_prior_bsvar_exh
R6 Class Representing PriorBSVARMIXspecify_prior_bsvar_mix
R6 Class Representing PriorBSVARMSHspecify_prior_bsvar_msh
R6 Class Representing PriorBSVARSVspecify_prior_bsvar_sv
R6 Class Representing PriorBSVARTspecify_prior_bsvar_t
R6 Class Representing StartingValuesBSVARspecify_starting_values_bsvar
R6 Class Representing StartingValuesBSVAREXHspecify_starting_values_bsvar_exh
R6 Class Representing StartingValuesBSVAHMSHspecify_starting_values_bsvar_hmsh
R6 Class Representing StartingValuesBSVARMIXspecify_starting_values_bsvar_mix
R6 Class Representing StartingValuesBSVARMSHspecify_starting_values_bsvar_msh
R6 Class Representing StartingValuesBSVARSVspecify_starting_values_bsvar_sv
Provides posterior summary of Forecastssummary.Forecasts
Provides posterior summary of homoskedastic Structural VAR estimationsummary.PosteriorBSVAR
Provides posterior summary of heteroskedastic Structural VAR estimationsummary.PosteriorBSVAREXH
Provides posterior summary of heteroskedastic Structural VAR estimationsummary.PosteriorBSVARHMSH
Provides posterior summary of non-normal Structural VAR estimationsummary.PosteriorBSVARMIX
Provides posterior summary of heteroskedastic Structural VAR estimationsummary.PosteriorBSVARMSH
Provides posterior summary of heteroskedastic Structural VAR estimationsummary.PosteriorBSVARSV
Provides posterior summary of Structural VAR with t-distributed shocks estimationsummary.PosteriorBSVART
Provides posterior summary of forecast error variance decompositionssummary.PosteriorFEVD
Provides posterior summary of variables' fitted valuessummary.PosteriorFitted
Provides posterior summary of historical decompositionssummary.PosteriorHD
Provides posterior summary of impulse responsessummary.PosteriorIR
Provides posterior summary of regime probabilitiessummary.PosteriorRegimePr
Provides posterior summary of structural shockssummary.PosteriorShocks
Provides posterior summary of structural shocks' conditional standard deviationssummary.PosteriorSigma
Provides summary of verifying hypotheses about autoregressive parameterssummary.SDDRautoregression
Provides summary of verifying shocks' normalitysummary.SDDRidMIX
Provides summary of verifying homoskedasticitysummary.SDDRidMSH
Provides summary of verifying homoskedasticitysummary.SDDRidSV
Provides summary of verifying shocks' normalitysummary.SDDRidT
Provides summary of verifying homoskedasticitysummary.SDDRvolatility
A matrix to be used in a conditional forecasting example including the projected values of total tax revenue that are projected to increase at an average quarterly sample growth rate. The other two columns are filled with 'NA' values, which implies that the future values of the corresponding endogenous variables, namely government spending and GDP, will be forecasted given the provided projected values of total tax revenue. The matrix includes future values for the forecast horizon of two years for the US fiscal model for the period 2024 Q3 - 2026 Q1.us_fiscal_cond_forecasts
A 3-variable system of exogenous variables for the US fiscal model for the period 1948 Q1 - 2026 Q1us_fiscal_ex
A 3-variable system of exogenous variables' future values for the forecast horizon of two years for the US fiscal model for the period 2026 Q2 - 2028 Q1us_fiscal_ex_forecasts
A 3-variable US fiscal system for the period 1948 Q1 - 2026 Q1us_fiscal_lsuw
Verifies hypotheses involving autoregressive parametersverify_autoregression
Verifies hypotheses involving autoregressive parametersverify_autoregression.PosteriorBSVAR
Verifies hypotheses involving autoregressive parametersverify_autoregression.PosteriorBSVAREXH
Verifies hypotheses involving autoregressive parametersverify_autoregression.PosteriorBSVARHMSH
Verifies hypotheses involving autoregressive parametersverify_autoregression.PosteriorBSVARMIX
Verifies hypotheses involving autoregressive parametersverify_autoregression.PosteriorBSVARMSH
Verifies hypotheses involving autoregressive parametersverify_autoregression.PosteriorBSVARSV
Verifies hypotheses involving autoregressive parametersverify_autoregression.PosteriorBSVART
Verifies identification through heteroskedasticity or non-normality of of structural shocksverify_identification
Verifies identification through heteroskedasticity or non-normality of of structural shocksverify_identification.PosteriorBSVAR
Verifies identification through heteroskedasticity or non-normality of of structural shocksverify_identification.PosteriorBSVAREXH
Verifies identification through heteroskedasticity or non-normality of of structural shocksverify_identification.PosteriorBSVARHMSH
Verifies identification through heteroskedasticity or non-normality of of structural shocksverify_identification.PosteriorBSVARMIX
Verifies identification through heteroskedasticity or non-normality of of structural shocksverify_identification.PosteriorBSVARMSH
Verifies identification through heteroskedasticity or non-normality of of structural shocksverify_identification.PosteriorBSVARSV
Verifies identification through heteroskedasticity or non-normality of of structural shocksverify_identification.PosteriorBSVART
Verifies normality of structural shocks equation by equationverify_normality
Verifies normality of structural shocks equation by equationverify_normality.PosteriorBSVAREXH
Verifies normality of structural shocks equation by equationverify_normality.PosteriorBSVARHMSH
Verifies normality of structural shocks equation by equationverify_normality.PosteriorBSVARMIX
Verifies normality of structural shocks equation by equationverify_normality.PosteriorBSVARMSH
Verifies normality of structural shocks equation by equationverify_normality.PosteriorBSVARSV
Verifies heteroskedasticity of structural shocks equation by equationverify_volatility
Verifies heteroskedasticity of structural shocks equation by equationverify_volatility.PosteriorBSVAR
Verifies heteroskedasticity of structural shocks equation by equationverify_volatility.PosteriorBSVAREXH
Verifies heteroskedasticity of structural shocks equation by equationverify_volatility.PosteriorBSVARHMSH
Verifies heteroskedasticity of structural shocks equation by equationverify_volatility.PosteriorBSVARMIX
Verifies heteroskedasticity of structural shocks equation by equationverify_volatility.PosteriorBSVARMSH
Verifies heteroskedasticity of structural shocks equation by equationverify_volatility.PosteriorBSVARSV