MATLAB and R code for Statistical Modeling and Computation (Second Edition, 2025) is at the book website, and MATLAB code for Bayesian Econometric Methods (Second Edition) is at its book website. Code for Bayesian Macroeconometrics: Methods and Applications (Chapman & Hall/CRC, forthcoming) is on GitHub, in MATLAB, R and Python for all fourteen chapters.

GitHub

bvar-toolkit collects ten of the packages below and factors the machinery they share — the samplers, the shrinkage priors, the marginal likelihood estimators — into a documented library, with fourteen examples to learn the methods.

statespace-toolkit collects fourteen other packages and factors the precision sampler, the integrated likelihood and the truncated normal sampler into a documented library, with eight examples to learn the methods.

trend-cycle-toolkit re-estimates six of the trend inflation and output gap models below every quarter and publishes the resulting estimates.

Tutorials

Six tutorials each answer one empirical question with the code of bvar-toolkit: the order of the variables in a VAR with stochastic volatility, the choice of shrinkage hyperparameters, stochastic volatility specifications, forecasting, sign restrictions in a large VAR, and missing and mixed-frequency data.

Start here

If you use code from this page, please cite the most relevant default reference(s) below. These papers form a coherent toolkit for scalable Bayesian time series and state space methods.

Research overviews: Large Bayesian VARs | High-dimensional state space models | Trend inflation models.

If you want to download the code associated with a particular paper, it will be easier to locate it at my research page. Below I organize the code by topics.

Please contact me if you find any errors.

Vector Autoregressions and VARMAs

See here for more information about my recent projects on large Bayesian VARs.

Stochastic Volatility and GARCH Models

Marginal Likelihood and Deviance Information Criterion

Models for Inflation

See here for more information about my research on trend inflation models.

Models for Output Gap

Other Models

Other Sources

A number of econometricians have provided code associated with their books or papers: