Make Good Use of Your Sidebar

Use this space for anything from simple blocks of text to powerful widgets, like our Twitter and Flickr widgets. Learn more.

To access Website Management, hit the 'esc' key or use this Login link.

Blog Index
The journal that this archive was targeting has been deleted. Please update your configuration.

Bayesian Macroeconometrics in R

BMR (Bayesian Macroeconometrics in R) is a collection of R and C++ routines for estimating Bayesian Vector Autoregressive (BVAR) and Dynamic Stochastic General Equilibrium (DSGE) models in the R statistical environment.

  • For BVARs, the following prior forms are included:
    • normal-inverse-Wishart prior,
    • Minnesota prior, and
    • Mattias Villani's steady-state prior.
  • The BMR package can also estimate BVARs with time-varying parameters, as well as classical (non-Bayesian) VARs.
  • For DSGE models, the package can
    • solve models using either Harald Uhlig's method of undetermined coefficients or Chris Sims' canonical decomposition;
    • estimate models using MCMC by means of a Kalman filter or the Chandrasekhar recursions; and
    • estimate a hybrid DSGE-VAR model.

Important License Information: BMR is licensed under the GNU General Public License (GPL) version 2, or (at your option) any later version. The experimental nature of this software means that it is intended for academic use only.

By downloading, installing, and/or using the software, you agree to these terms, to the terms of the GPL v2, and release me from any liability whatsoever arising from use of this software.

Package requirements: the latest versions of R (v3.20, or above), Rcpp, RcppArmadillo (>= v0.5.300.4), ggplot2, doParallel, and grid (this comes pre-packaged with new R releases).

Execute the following commands, post installation of R itself, and you should be good to go:


Download BMR Build BMR Build

Current version: 0.5.4, 2016-06-18.

  • The source code is available on GitHub. You need to install BMR from source.
    • Perhaps the quickest way to install from source is via the 'devtools' package in R.
    • First, make sure you have the appropriate development environment; if you're using a Mac, get Xcode from the App Store; if you're using Windows, get Rtools.
      • Note: For Mac users, unless you've compiled R from source, you will also need gfortran v4.8.2 as well. This can be obtained using (from a terminal window):
      •    curl -O
           sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /
    • Then simply run the following commands in R:
    •    install.packages("devtools")
    • Note: Due to Rlapack being a lobotomized distribution of LAPACK, the 'gensys' solver is not available on Windows-based machines. If you happen to have a full installation of LAPACK, then install from source by first modifying 'dsgec.cpp' appropriately, rather than using the binary file. This is not an issue for Unix-based systems (e.g., Mac and Linux distros). We're currently working on a bigger Rlapack patch to fix issues like this. This has been fixed in R v3.3.0.


  • Accompanying vignette: link.
  • PDF of BMR help files: link. The help files can also be accessed in the R environment using '?chosen_function'; for example, ?BVARM.

The vignette (linked above) is intended to be a comprehensive guide to the routines (and what goes on under the hood, so to speak) and should be consulted first before submitting any questions to me about the package. I am more than happy to receive bug reports (and comments in general) about BMR, use the contact tab above to do so, but I am not willing to provide technical support for the package. (Technical support in the sense of 'how do I get my model into the required format', or 'what prior should I use'.)

After installing BMR, the user can check if everything is working as intended by typing:


This should load BMR and place a dataframe called 'USMacroData' into the workspace.

Replication files/models.

Replication files can be found on a separate page: link.

Release notes

  • Version 0.5.1, 07/2015:
    • Bug fix release for Windows systems;
    • Rlapack does not possess the necessary routines to perform a QZ decomposition, a feature that will be available in future release of Armadillo, nor can it invert complex-valued matrices via a LU decomposition. For now, 'gensys' will return an error on Windows-based machines.
  • Version 0.5.0, 07/2015:
    • BMR now includes a C++ implementation of Chris Sims' 'gensys' solver;
    • speed and stability improvements;
    • the package should pass all CRAN checks;
    • minor bug fixes; and
    • updates to the example and help files.
  • Version 0.4.3, 02/2015:
    • Improved error handling between R and compiled C++ code;
    • new state plotting function for estimated DSGE and DSGE-VAR models (see ?states);
    • general improvements to plotting style; and
    • updated the example and help files.
  • Version 0.4.2, 01/2015:
    • Primarily a patch update;
    • new forecast function for estimated DSGE models;
    • revamped plotting style;
    • changed terminal output format to 'message';
    • better error catching in the C++ code to avoid fatal errors;
    • bug fix for BVARTVP models with more than 3 variables;
    • minor bug fixes; and
    • updated the documentation and help files.
  • Version 0.4.0, 07/2014:
    • Better support for larger DSGE models;
    • intercept terms in the measurement equation and measurement equation error-variances are now required inputs to the EDSGE and DSGEVAR functions, which is done through 'partomats' (see the updated example files linked above);
    • code for the An and Schorfheide (2007) and Lubik and Schorfheide (2007) models;
    • a new function ('prior') to plot prior distributions and print first and second moments;
    • a new simple wrapper function ('gtsplot') to plot time-series data;
    • DSGEVAR function input changed to include a constant (intercept) term; and
    • updated the documentation and help files.
  • Version 0.3.0:
    • DSGEVAR function now supports multiple MCMC chains running in parallel;
    • better posterior mode estimation for DSGE and DSGEVAR models via sequential optimization using multiple optimization routines;
    • faster estimation of large DSGE models using the Chandrasekhar Recursions;
    • setting keep = 0 in EDSGE and DSGEVAR will return the posterior mode approximation only;
    • EDSGE and DSGEVAR functions now return a Laplace approximation to the marginal likelihood;
    • updated the help documentation and vignette; and
    • minor bug fixes.
  • Version 0.2.0:
    • BMR now supports some DSGE-VAR functionality (see ?DSGEVAR);
    • parallel processing options are available for BVARW and EDSGE when running multiple MCMC chains;
    • speed improvements for most core functions, particularly BVARW, BVARTVP, and EDSGE;
    • updated the help documentation;
    • fixed some weird pathologies when the BVAR lag order was set to 1 (p=1); and
    • other bug fixes.
  • Version 0.1.1:
    • Several minor bug fixes;
    • improvements to the help documentation; and
    • inclusion of the artificial VAR data used in sections 6.1 and 6.3 of the vignette.
  • Version 0.1: First release, August 2012.