This paper introduces a machine learning algorithm called Sequential Neural Posterior Estimation (SNPE) for estimating structural heterogeneous agent macroeconomic models. SNPE is a simulation-based algorithm that aims to approximate the joint distribution of parameters and simulated data. It then uses a conditional density estimator to obtain the posterior distribution. The algorithm offers several advantages, including the ability to handle any black box solution method, improved speed and accuracy compared to existing Bayesian algorithms, and statistically efficient simulation-based estimates. The algorithm outperforms Markov Chain Monte Carlo in estimating Bayesian posteriors for benchmark models such as Smets-Wouters (2007) and improves estimation speed for Heterogeneous Agent New Keynesian (HANK) models. An empirical application demonstrates the effectiveness of this technique in estimating a heterogeneous agent model using both aggregate time series and cross-sectional micro-data.
A tutorial can be found at: https://shorturl.at/pMQ18