Package: bvartools 1.0.0

bvartools: Bayesian Inference of Vector Autoregressive and Error Correction Models

Assists in the set-up of algorithms for Bayesian inference of vector autoregressive (VAR) and error correction (VEC) models. Functions for posterior simulation, forecasting, impulse response analysis and forecast error variance decomposition are largely based on the introductory texts of Chan, Koop, Poirier and Tobias (2019, ISBN: 9781108437493), Koop and Korobilis (2010) <doi:10.1561/0800000013> and Luetkepohl (2006, ISBN: 9783540262398).

Authors:Franz X. Mohr [aut, cre, cph]

bvartools_1.0.0.tar.gz
bvartools_1.0.0.zip(r-4.7-x86_64)bvartools_1.0.0.zip(r-4.7-arm64)bvartools_1.0.0.zip(r-4.6-x86_64)bvartools_1.0.0.zip(r-4.6-arm64)bvartools_1.0.0.zip(r-4.5-x86_64)
bvartools_1.0.0.tgz(r-4.6-x86_64)bvartools_1.0.0.tgz(r-4.6-arm64)bvartools_1.0.0.tgz(r-4.5-x86_64)bvartools_1.0.0.tgz(r-4.5-arm64)
bvartools_1.0.0.tar.gz(r-4.7-arm64)bvartools_1.0.0.tar.gz(r-4.7-x86_64)bvartools_1.0.0.tar.gz(r-4.6-arm64)bvartools_1.0.0.tar.gz(r-4.6-x86_64)
bvartools_1.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
bvartools/json (API)

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

Bug tracker:https://github.com/franzmohr/bvartools/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
Datasets:
  • at_macrodata - Austrian sub-model of a global VAR
  • e1 - West German economic time series data
  • e6 - German interest and inflation rate data
  • uk_macrodata - UK interest and inflation rate data
  • us_macrodata - US macroeconomic data

On CRAN:

Conda:

bayesianbayesian-inferencebayesian-varbvarbvecmgibbs-samplingmcmcvector-autoregressionvector-error-correction-modelopenblascpp

8.88 score 34 stars 2 packages 93 scripts 993 downloads 1 mentions 87 exports 28 dependencies

Last updated from:5aa5ba7e7e. Checks:15 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK676
linux-devel-x86_64OK584
source / vignettesOK865
linux-release-arm64OK691
linux-release-x86_64OK815
macos-release-arm64OK691
macos-release-x86_64OK1055
macos-oldrel-arm64OK544
macos-oldrel-x86_64OK1121
windows-devel-arm64OK1042
windows-devel-x86_64OK949
windows-release-arm64OK1044
windows-release-x86_64OK1258
windows-oldrel-x86_64OK1124
wasm-releaseOK507

Exports:add_dummy_variablesadd_forecast_errorsadd_forecast_inputadd_initial_valuesadd_posterior_coefficientsadd_posterior_forecastsadd_posterior_loglikadd_predictive_loglikadd_prior_optionsadd_priorsadd_seedadd_sign_restrictionsadd_sign_zero_restrictionsaggregate_forecastsaggregation_weightsalign_model_obsarias_rubio_ramirez_waggoner_2018bayests_filesbayests_posteriorbvarbvecchain_diagnosticscheck_discount_specificationchoose_best_modelcoint_kls2010_reparameterise_twocoint_prepare_sur_datacointspace_priorcombine_modelscovar_prepare_datacovar_vector_to_matrixcreate_bvarmodelcreate_bvecmodelcreate_external_forecastexpected_model_sizefevdfrom_bayests_treegenerate_artificial_vargenerate_artificial_vecgenerate_lower_block_diagonalget_forecast_errorsget_model_specificationshistorical_decompositioninclusion_priorirfis_discount_modelkalman_durbin_koopman_2002list_models_in_hdf5loglik_normalmap_drawsmap_modelsminnesota_priormodel_filesmultipliersopen_modelopen_modelspersistence_profilesplot_forecast_errors_by_periodplot_predictive_loglikpool_forecastspost_bvspost_coint_klspost_coint_kls_surpost_gamma_measurement_variancepost_gamma_state_variancepost_normalpost_normal_surprepare_forecast_inputread_bayests_treeread_expanding_window_model_from_folderread_model_from_hdf5read_models_from_folderrescale_error_correctionscale_error_correctionselection_criteriaspilloversplit_quantile_gridssvsssvs_priorstochvol_ksc_1998stochvol_ocsn_2007sur_const_to_tvptime_variation_testtransform_variablesuse_expanding_windowvec_to_varwrite_bayests_treewrite_to_hdf5

Dependencies:abindbackportsbitbit64checkmateclicodadistributionalgenericsgluehdf5rlatticelifecyclemagrittrMatrixmatrixStatsnumDerivpillarpkgconfigposteriorR6RcppRcppArmadillorlangtensorAtibbleutf8vctrs

Horse Races
Introduction | Workflow | Producing candidate models | Draw posteriors | Forecasting | Evaluation | In-sample plots | Out-of-sample plots | Pooling forecasts | Adding forecasts from other sources | Citing bvartools | References

Last update: 2026-09-27
Started: 2026-08-30

Model Comparison in bvartools
Data | Set up models | Priors | Initial values | Posterior simulation | Model selection | Citing bvartools | Literature

Last update: 2026-09-22
Started: 2020-09-17

Time Varying Parameters and Stochastic Volatility in bvartools
Introduction | Data | Model set-up | Priors | Initial values and posterior draws | Evaluation | Summary statistics for a period | Coefficient paths | Volatility paths | Impulse responses for a period | Forecasts | Other combinations | Citing bvartools | References

Last update: 2026-09-22
Started: 2026-09-11

Time Varying Parameters and Stochastic Volatility in Error Correction Models
Introduction | Data | Model set-up | Priors | Initial values and posterior draws | Evaluation | Summary statistics for a period | Coefficient and volatility paths | A prior centred on the maximum likelihood estimate | Impulse responses and forecasts | Citing bvartools | References

Last update: 2026-09-22
Started: 2026-09-11

Bayesian Error Correction Models with Priors on the Cointegration Space
Introduction | Data | Priors | Adding initial values | Estimation | User-specific algorithm | Default algorithm | A prior centred on the maximum likelihood estimate | Evaluation | Forecasts | Forecast error impulse response | Forecast error variance decomposition | Citing bvartools | References

Last update: 2026-09-16
Started: 2019-03-24

Bayesian Quantile VARs in bvartools
Introduction | Model set-up | Data | Setting up a model | Adding prior hyperparameters | Adding initial values | Obtaining posterior draws | Evaluation | Summary statistics | Does it estimate the quantile it was asked for? | The scale of the asymmetric Laplace | A grid of quantiles | Time varying parameters | What these models do not do | Citing bvartools | References

Last update: 2026-09-16
Started: 2026-09-10

Introduction to bvartools
Introduction | Model set-up | Data | Setting up a model | Adding prior hyperparameters | Adding initial values | Obtaining posterior draws | Evaluation | Inspect posterior draws | Summary statistics | Thin results | Application | Forecasts | Impulse response analysis | Forecast error impulse response | Orthogonalised impulse response | Generalised impulse response | Variance decomposition | Forecast error variance decomposition | Generalised forecast error variance decomposition | Using bvartools with user-written algorithms | Model set-up and prior specifications | A Gibbs sampler algorithm | bvarmodel objects | Citing bvartools | References

Last update: 2026-09-16
Started: 2019-02-07

Sign Restrictions in bvartools
Introduction | The model | Imposing the restrictions | Impulse responses | Why not simply order the variables? | Variance decomposition and spillovers | Reading a set identified result | Citing bvartools | References

Last update: 2026-09-16
Started: 2026-09-11

Stochastic Search Variable Selection in bvartools
Introduction | Inference based on a user-written algorithm | Using the built-in simulation algorithm of bvartools | Citing bvartools | References

Last update: 2026-09-16
Started: 2019-02-17

Minnesota Prior
Introduction | Workflow for VAR models | Create a model | Adding model priors | Direct approach | Using add_priors | Adding initial values | Obtaining posterior draws | Citing bvartools | References

Last update: 2026-09-13
Started: 2026-08-28

Readme and manuals

Help Manual

Help pageTopics
Dummy Variablesadd_dummy_variables
Dummy Variablesadd_dummy_variables.bvarmodel add_dummy_variables.bvecmodel add_dummy_variables.expandingwindow add_dummy_variables.modellist
Add Forecast Errorsadd_forecast_errors
Add Forecast Errorsadd_forecast_errors.bvarmodel
Add Forecast Errorsadd_forecast_errors.bvecmodel
Add Forecast Errorsadd_forecast_errors.expandingwindow
Add Forecast Errorsadd_forecast_errors.modellist
Add Forecast Input Dataadd_forecast_input
Add Forecast Input Dataadd_forecast_input.bvarmodel
Add Forecast Input Dataadd_forecast_input.bvecmodel
Add Forecast Input Dataadd_forecast_input.expandingwindow
Add Forecast Input Dataadd_forecast_input.modellist
Add Initial Values of an MCMC Chainadd_initial_values
Add Initial Values of an MCMC Chainadd_initial_values.bvarmodel
Add Initial Values of an MCMC Chainadd_initial_values.bvecmodel
Add Initial Values of an MCMC Chainadd_initial_values.expandingwindow
Add Initial Values of an MCMC Chainadd_initial_values.modellist
Posterior Simulation of Model Coefficientsadd_posterior_coefficients
Posterior Simulation of Model Coefficientsadd_posterior_coefficients.bvarmodel
Posterior Simulation of Model Coefficientsadd_posterior_coefficients.bvecmodel
Posterior Simulation of Model Coefficientsadd_posterior_coefficients.expandingwindow
Posterior Simulation of Model Coefficientsadd_posterior_coefficients.modellist
Add Forecastsadd_posterior_forecasts
Add Forecastsadd_posterior_forecasts.bvarmodel
Add Forecastsadd_posterior_forecasts.bvecmodel
Add Forecastsadd_posterior_forecasts.expandingwindow
Add Forecastsadd_posterior_forecasts.modellist
Add Log-Likelihoodadd_posterior_loglik
Add Log-Likelihoodadd_posterior_loglik.bvarmodel
Add Log-Likelihoodadd_posterior_loglik.bvecmodel
Add Log-Likelihoodadd_posterior_loglik.expandingwindow
Add Log-Likelihoodadd_posterior_loglik.modellist
Add Predictive Log-Likelihoodadd_predictive_loglik add_predictive_loglik.expandingwindow add_predictive_loglik.modellist
Add the Log Predictive Density of a Forecastadd_predictive_loglik.bvarmodel
Add the Log Predictive Density of a Forecastadd_predictive_loglik.bvecmodel
Adaptive Priors, Stationarity and the Steady Stateadd_prior_options
Add Priors to Bayesian Modelsadd_priors
Add Priors to Bayesian Modelsadd_priors.bvarmodel
Add Priors to Bayesian Modelsadd_priors.bvecmodel
Add Priors to Bayesian Modelsadd_priors.expandingwindow
Add Priors to Bayesian Modelsadd_priors.modellist
Seed of the Posterior Simulationadd_seed add_seed.bvarmodel add_seed.bvecmodel add_seed.expandingwindow add_seed.modellist
Sign Restrictionsadd_sign_restrictions
Sign Restrictionsadd_sign_restrictions.bvarmodel add_sign_restrictions.expandingwindow add_sign_restrictions.modellist
Sign and Zero Restrictionsadd_sign_zero_restrictions
Sign and Zero Restrictionsadd_sign_zero_restrictions.bvarmodel add_sign_zero_restrictions.expandingwindow add_sign_zero_restrictions.modellist
Aggregate Forecasts to Annual Figuresaggregate_forecasts
Weights of a Temporal Aggregateaggregation_weights
Align Observations Across Modelsalign_model_obs
Align Observations Across Modelsalign_model_obs.modellist
Impulse Responses and Variance Decompositions of a Stored Modelanalysis_of_stored_models fevd.bvarfile irf.bvarfile
Sign and Zero Restricted Rotations of Posterior Drawsarias_rubio_ramirez_waggoner_2018
Austrian sub-model of a global VARat_macrodata
Run BayesTS on Stored Modelsbayests_files
Posterior Simulation with the BayesTS Executablebayests_posterior
Bayesian Vector Autoregression Objectsbvar
The Structure of a Model Objectbvartools_model
Bayesian Vector Error Correction Objectsbvec
Convergence Diagnostics of Several Chainschain_diagnostics
Choose Best Modelchoose_best_model
Choose Best Modelchoose_best_model.selcritlist
Cointegration Reparameterisationcoint_kls2010_reparameterise_two
Posterior Data Preparationcoint_prepare_sur_data
Build the Prior on the Cointegration Spacecointspace_prior
Combine Modelscombine_models
Covariance: Data Preparationcovar_prepare_data
Covariance: Vector to Matrixcovar_vector_to_matrix
Create a Vector Autoregressive Modelcreate_bvarmodel
Create Vector Error Correction Modelscreate_bvecmodel
Objects for Externally Produced Forecastsadd_forecast_input.externalforecast add_initial_values.externalforecast add_posterior_coefficients.externalforecast add_posterior_forecasts.externalforecast add_posterior_loglik.externalforecast add_priors.externalforecast add_seed.externalforecast create_external_forecast inclusion_prior.externalforecast minnesota_prior.externalforecast print.externalforecast ssvs_prior.externalforecast thin.externalforecast
The Discounted Modelscheck_discount_specification discount_models is_discount_model
West German economic time series datae1
German interest and inflation rate datae6
Expected Size of a Modelexpected_model_size
Expected Size of a Modelexpected_model_size.bvarmodel expected_model_size.bvecmodel expected_model_size.expandingwindow expected_model_size.modellist
Forecast Error Variance Decompositionfevd
Forecast Error Variance Decompositionfevd.bvarmodel
Forecast Error Variance Decompositionfevd.bvecmodel
Estimation Steps on a Folder of Modelsadd_initial_values.bvarfolder add_posterior_coefficients.bvarfolder add_posterior_loglik.bvarfolder add_priors.bvarfolder add_seed.bvarfolder folder_steps selection_criteria.bvarfolder thin.bvarfolder time_variation_test.bvarfolder
Turn the Tree of a Model File into a Modelfrom_bayests_tree from_bayests_tree.default
Generate Artificial VAR Datagenerate_artificial_var
Generate Artificial VEC Datagenerate_artificial_vec
Posterior Data Preparationgenerate_lower_block_diagonal
Get Forecast Errorsget_forecast_errors
Get Model Specificationsget_model_specifications
Historical Decompositionhistorical_decomposition
Historical Decomposition of a Vector Autoregressive Modelhistorical_decomposition.bvarmodel
Prior Inclusion Probabilitiesinclusion_prior
Prior Inclusion Probabilitiesinclusion_prior.bvarmodel
Prior Inclusion Probabilitiesinclusion_prior.bvecmodel
Impulse Response Functionirf
Impulse Response Functionirf.bvarmodel
Impulse Response Functionirf.bvecmodel
Durbin and Koopman Simulation Smootherkalman_durbin_koopman_2002
Models in an HDF5 Filelist_models_in_hdf5
Log-Likelihood of a Multivariate Normal Distributionloglik_normal
Apply a Function to the Draws of a Stored Modelmap_draws
Apply a Function to the Models of a Foldermap_models
Minnesota Priorminnesota_prior
Minnesota Priorminnesota_prior.bvarmodel
Minnesota Priorminnesota_prior.bvecmodel
Minnesota Priorminnesota_prior.modellist
Dynamic Multipliersmultipliers
Dynamic Multipliers of a VAR Model with Exogenous Variablesmultipliers.bvarmodel
Dynamic Multipliers of a VEC Model with Exogenous Variablesmultipliers.bvecmodel
Open a Model Stored in an HDF5 Fileopen_model print.bvarfile
Open a Folder of Stored Modelsmodel_files open_models print.bvarfolder
Persistence Profilespersistence_profiles
Persistence Profiles of a VEC Modelpersistence_profiles.bvarmodel persistence_profiles.bvecmodel persistence_profiles.expandingwindow persistence_profiles.modellist
Plotting Forecast Errors per Periodplot_forecast_errors_by_period
Plotting the Log Predictive Likelihood per Periodplot_predictive_loglik
Plotting Forecast Error Variance Decompositions of Bayesian Vector Autoregressionplot.bvarfevd
Plot a Historical Decompositionplot.bvarhd
Plotting Impulse Responses of Bayesian Vector Autoregressionplot.bvarirf
Plotting Draws of a Bayesian VAR Modelplot.bvarmodel
Plotting Forecasts of BVAR Modelsplot.bvarprd
Plotting Forecasts of a List of Bayesian VAR Modelsplot.bvarprdlist
Plot a Spillover Indexplot.bvarspillover
Plot a Rolling Spillover Indexplot.bvarspilloverts
Plotting Draws of a Bayesian VEC Modelplot.bvecmodel
Plotting Forecasts of a List of Bayesian VAR Modelsplot.expandwindbvarprdlist
Plotting Draws of a Bayesian Time Series Modelsplot.modellist
Plotting Selection Criteriaplot.selcrit plot.selcritlist
Pool Forecastsadd_forecast_input.forecastpool add_forecast_input.poolwindow add_initial_values.forecastpool add_initial_values.poolwindow add_posterior_coefficients.forecastpool add_posterior_coefficients.poolwindow add_posterior_forecasts.forecastpool add_posterior_forecasts.poolwindow add_posterior_loglik.forecastpool add_posterior_loglik.poolwindow add_predictive_loglik.forecastpool add_predictive_loglik.poolwindow add_priors.forecastpool add_priors.poolwindow add_seed.forecastpool add_seed.poolwindow pool_forecasts print.forecastpool print.poolwindow thin.forecastpool thin.poolwindow write_to_hdf5.forecastpool write_to_hdf5.poolwindow
Bayesian Variable Selectionpost_bvs
Posterior Draw for Cointegration Modelspost_coint_kls
Posterior Draw for Cointegration Modelspost_coint_kls_sur
Posterior Draws of Error Variancespost_gamma_measurement_variance
Posterior Draws of Error Variancespost_gamma_state_variance
Posterior Draw from a Normal Distributionpost_normal
Posterior Draw from a Normal Distributionpost_normal_sur
Predict Method for Objects of Class bvarpredict.bvarmodel
Predict Method for Objects of Class bvecmodelpredict.bvecmodel
Predict Method for Objects of Class expandingwindowpredict.expandingwindow
Predict Method for Objects of Class modellistpredict.modellist
Prepare Forecast Inputprepare_forecast_input
Prepare Forecast Inputprepare_forecast_input.bvarmodel
Prepare Forecast Inputprepare_forecast_input.bvecmodel
Printing Model Informationprint.bvarmodel
Print a Spillover Indexprint.bvarspillover
Printing Model Informationprint.bvecmodel
Printing Model Informationprint.modellist
Import Models from HDF5 Filesread_expanding_window_model_from_folder
Import Models from HDF5 Filesread_model_from_hdf5
Import Models from a Folder of HDF5 Filesread_models_from_folder
Rescale Error Correctionrescale_error_correction
Rescale Error Correctionrescale_error_correction.bvecmodel
Scale Error Correctionscale_error_correction
Scale Error Correctionscale_error_correction.bvecmodel
Model Selection Criteriaprint.selcrit print.selcritlist selection_criteria
Model Selection Criteriaselection_criteria.bvarmodel
Model Selection Criteriaselection_criteria.bvecmodel
Selection Criteriaselection_criteria.default
Model Selection Criteriaselection_criteria.expandingwindow
Model Selection Criteriaselection_criteria.externalforecast
Model Selection Criteriaselection_criteria.modellist
Spillover Indexspillover
Spillover Indexspillover.bvarmodel
Spillover Indexspillover.bvecmodel
Rolling Spillover Indexspillover.expandingwindow
Spillover Indexspillover.modellist
Single Quantiles of a Quantile Gridsplit_quantile_grid
Stochastic Search Variable Selectionssvs
Stochastic Search Variable Selection Priorssvs_prior
Stochastic Search Variable Selection Priorssvs_prior.bvarmodel
Stochastic Search Variable Selection Priorssvs_prior.bvecmodel
Stochastic Volatilitystochvol_ksc_1998
Stochastic Volatilitystochvol_ocsn_2007
Summarising Bayesian VAR Coefficientsprint.summary.bvarmodel summary.bvarmodel
Summarising Bayesian VEC Coefficientsprint.summary.bvecmodel summary.bvecmodel
Summarising Bayesian Modelssummary.expandingwindow
Summarising Bayesian Modelssummary.modellist
SUR Matrix Transformationsur_const_to_tvp
Thinning Posterior Drawsthin.bvarmodel
Thinning Posterior Drawsthin.bvecmodel
Thinning Posterior Drawsthin.expandingwindow
Thinning Posterior Drawsthin.modellist
Test for Time Variationtime_variation_test
Test for Time Variation in a VAR or VEC Modeltime_variation_test.bvarmodel time_variation_test.bvecmodel time_variation_test.expandingwindow time_variation_test.modellist
Apply Transformationstransform_variables
UK interest and inflation rate datauk_macrodata
US macroeconomic dataus_macrodata
Expanding Window Estimationuse_expanding_window
Expanding Window Estimationuse_expanding_window.bvarmodel
Expanding Window Estimationuse_expanding_window.bvecmodel
Expanding Window Estimationuse_expanding_window.modellist
Transform a VEC Model to a VAR in Levelsvec_to_var
Transform a VEC Model to a VAR in Levelsvec_to_var.bvecmodel
Transform VEC Models to VARs in Levelsvec_to_var.expandingwindow
Transform a VEC Model to a VAR in Levelsvec_to_var.modellist
Time Series Windowswindow.bvarmodel
Time Series Windowswindow.bvecmodel
Time Series Windowswindow.modellist
Write and Read the Tree of a BayesTS Model Fileread_bayests_tree write_bayests_tree
Export to HDF5 Filewrite_to_hdf5
Export to HDF5 Filewrite_to_hdf5.bvarmodel
Export to HDF5 Filewrite_to_hdf5.bvecmodel
Export to HDF5 Filewrite_to_hdf5.expandingwindow
Export to HDF5 Filewrite_to_hdf5.modellist