Sequential Monte Carlo comes to DSGE.jl



Hi all,

As some of you may know (from JuliaCon or otherwise), we at the Federal Reserve Bank of New York (FRBNY) have been developing the package DSGE.jl to solve and estimate Dynamic Stochastic General Equilibrium macroeconomic models for use in forecasting and research (see here for our introductory blog post and here for some more technical comments). We take a Bayesian approach to estimation, so characterizing the entire posterior distribution of a model’s parameters is of great interest to us. Because this posterior is analytically intractible in most modern DSGE models, it is customary to use the Metropolis Hastings MCMC algorithm to sample from it. As our models have grown in complexity, however, the shortcomings of Metropolis Hastings (e.g. serial correlation between draws, a resistance to parallelization, and a tendency to get stuck in local modes) have become more burdensome. To address this issue, we have begun to implement sequential Monte Carlo (SMC) sampling as described in Ed Herbst and Frank Schorfheide’s paper Sequential Monte Carlo Sampling for DSGE Models.

SMC’s strengths lie in evaluating difficult integrals efficiently, and as such it has been used to filter non-linear or non-Gaussian processes and approximate complex posterior distributions. The SMC class of algorithms as applied to DSGE models is described in depth in Herbst and Schorfheide’s paper. In brief, we start with a large number of draws (or “particles”) from a tractable and easy-to-sample initial distribution, and then iteratively constructing a series of “bridge” distributions. At each stage the particles are mutated using Metropolis Hastings, reweighted using an importance sampler, and potentially resampled to eliminate degenerate particles. Repeated iteration produces a final distribution that approximates the posterior of our model. This procedure is both more efficient than our standard approach and easily parallelizable, yielding substantial performance improvements.

For now, SMC works primarily on the small-scale New Keynesian model presented in Sungbae An and Frank Schorfheide’s Bayesian Analysis of DSGE Models. In the future, we hope to implement additional features (such as blocked parameter sampling) and add the capability to estimate the medium-scale DSGE models commonly used at FRBNY. Our code can be found on the smc branch of our main package. Development is ongoing, and we welcome any suggestions or comments the community may have!

Abhi Gupta, Pearl Li, and Erica Moszkowski

@emoszkowski @pearlzli


SMC methods are useful on their own outside of DSGEs. Do you think that this could be put to a separate package which is used by DSGE, but gives access to it directly for other developers?


Thanks for your interest! We’ve talked about breaking out some of the algorithms (samplers, state space filters and smoothers, optimizers, etc.) in DSGE.jl into a separate package in the future. That would likely come a little further down the line, as we’re still working on moving all of our daily-use MATLAB code into Julia. However, we’re definitely interested in doing this!


Very interesting, I’ll be having a look. This solves the model using first order perturbation?


This looks very interesting! thanks, I will try to study it.

I’m doing primitive MC economy simulation for free to play games.
Hope I can understand some of those and Implement for my work.