Discussion paper

DP17576 Differentiable State-Space Models and Hamiltonian Monte Carlo Estimation

We propose a methodology to take dynamic stochastic general equilibrium (DSGE) models to the data based on the combination of differentiable state-space models and the Hamiltonian Monte Carlo (HMC) sampler. First, we introduce a method for implicit automatic differentiation of perturbation solutions of DSGE models with respect to the model's parameters. We can use the resulting output for various tasks requiring gradients, such as building an HMC sampler, to estimate first- and second-order approximations of DSGE models. The availability of derivatives also enables a general filter-free method to estimate nonlinear, non-Gaussian DSGE models by sampling the joint likelihood of parameters and latent states. We show that the gradient-based joint likelihood sampling approach is superior in efficiency and robustness to standard Metropolis-Hastings samplers by estimating a canonical real business cycle model, a real small open economy model, and a medium-scale New Keynesian DSGE model.


Childers, D, J Fernández-Villaverde, J Perla, C Rackauckas and P Wu (2022), ‘DP17576 Differentiable State-Space Models and Hamiltonian Monte Carlo Estimation‘, CEPR Discussion Paper No. 17576. CEPR Press, Paris & London. https://cepr.org/publications/dp17576