Automated Solution of Heterogeneous Agent Models


In this paper I present and analyze a new linearization based method for automated solution of heterogeneous agent models with continuously distributed heterogeneity and aggregate shocks. The approach is based on representation of the model equilibrium conditions as a system of smooth functional equations in terms of endogenously time-varying distributions and decision rules. Taking the value of these functions at a set of grid points as arguments, the equilibrium conditions can then be linearized, interpolated with respect to a set of basis functions, and solved through a procedure relying on automatic differentiation and standard discrete time linear rational expectations solution algorithms. While solution approaches based on linearization of discretized or projected models have achieved substantial popularity in recent years, it has been unclear whether such approaches generate solutions which correspond to that of the true infinite dimensional model. I characterize a broad class of models and a set of regularity conditions which ensure that this is indeed the case: the solution algorithm is guaranteed to converge to the first derivative of the true infinite dimensional solution as the discretization is refined. The key conceptual result leading to these methods is a recognition that a broad variety of heterogeneous agent models can be interpreted as infinite width deep neural networks [Guss, 2017], constructed entirely by iterated composition of pointwise nonlinearities and linear integral operators along a directed acyclic computational graph. On a theoretical level, this formulation ensures commutativity of differentiation and sampling and so permits construction of approximate functional derivatives without performing direct manual calculations in infinite dimensional space. On a practical level, this permits implementation using existing fast and scalable libraries for automatic differentiation on Euclidean space while maintaining the consistency guarantees derived for solutions based on derivatives computed directly in infinite dimensional space in Childers [2018]. In addition to providing precise technical conditions under which this method yields accurate representations, I provide examples and guidelines for how to formulate models to ensure that these conditions are satisfied. These conditions are shown to hold in models which possess smooth conditional densities of idiosyncratic state variables as in the class of heterogeneous agent models formalized in Arellano and Bonhomme [2016] augmented with aggregate shocks, subject to a particular choice of representation of the model equations which can be implemented by a change of variables. Convergence rates for the approximation are derived, depending on the classes of functions defining the nodes in the network and the overall network topology for a variety of choices of interpolation method including polynomials, splines, histograms, and wavelets. The procedure is demonstrated numerically by application to a version of the incomplete markets model of Huggett [1993] with continuously distributed idiosyncratic and aggregate income risk.