Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

8 Heterogeneous Agent Models in Continuous Time

University of Lausanne

Building on the PINN foundations of Chapter Chapter 7, this chapter develops the full continuous-time heterogeneous-agent framework: the coupled system of the Hamilton--Jacobi--Bellman equation (for individual optimization) and the Kolmogorov forward equation (for the stationary wealth distribution), closed by a market-clearing condition. This is the continuous-time analogue of the discrete-time Krusell--Smith economy of Chapter Chapter 6. The primary reference is Achdou et al. (2022); for pedagogical background on the continuous-time methods, see also Moll’s lecture notes.[1]

In the previous chapter, we applied PINNs to individual PDEs (ODEs, the Poisson equation, the HJB for cake-eating, and the Black--Scholes equation). This chapter makes the leap to equilibrium systems: coupled PDEs that arise when a continuum of heterogeneous agents interact through prices. The theoretical framework draws on the Bewley--Huggett--Aiyagari tradition, formulated in continuous time following Achdou et al. (2022). We derive the two core PDEs, the Hamilton--Jacobi--Bellman (HJB) equation for individual optimization and the Kolmogorov forward equation (KFE) for the cross-sectional density, and show how they are coupled through market clearing. The chapter culminates with the master equation, a single (infinite-dimensional) PDE that encapsulates the full equilibrium, and with EMINNs, introduced by Gu et al. (2024), which solve it using deep learning.

8.0.0.1Companion notebook.

One notebook accompanies this chapter and the Lecture 13 numerical deck: lecture_13_08_Aiyagari_Continuous_Time_FD_and_PINN_PyTorch.ipynb. It first computes the stationary Aiyagari equilibrium with an upwind finite-difference solver, then freezes those equilibrium prices and trains a PINN for the coupled HJB--KFE system at them (with normalization, boundary-flux, state-constraint, and aggregate-capital diagnostics) -- so the PINN stage is an equilibrium-consistency and representation exercise, not a price-discovery algorithm. For transparency the notebook specializes the general CRRA/switching equations below to log utility (γ=1\gamma=1) and symmetric two-state Poisson switching; the formulas in this chapter are the general case. The detailed upwind finite-difference scheme and PINN losses are developed in the accompanying Lecture 13 deck; this chapter focuses on the continuous-time equilibrium equations and the conceptual bridge to master-equation methods. (A partial-equilibrium HJB on its own is just a single-PDE PINN problem of the kind treated in Chapter Chapter 7; here we go straight to the coupled equilibrium system.)

8.0.0.2Where does gg come from?

Before turning to the PDEs themselves, it is worth fixing the economic picture. The model has a continuum of agents, each indexed by an idiosyncratic state (a,z)(a,z) comprising wealth aa and a labor or productivity component zz. Each agent solves its own HJB equation taking the prices (r,w)(r,w) as given, which yields an optimal savings policy that pushes mass through wealth space. The Kolmogorov forward equation tracks how this aggregate mass evolves, and its stationary solution g(a,z)g^\star(a,z) is the cross-sectional density that the general-equilibrium clearing equations integrate against to obtain aggregate capital, K=ag(a,z)dadzK = \int a\, g^\star(a,z)\,da\,dz, and aggregate labor, L=zg(a,z)dadzL = \int z\, g^\star(a,z)\,da\,dz.

8.1Why Continuous Time?

Chapters Chapter 2--Chapter 6 formulated heterogeneous-agent models in discrete time. Working in continuous time offers several complementary advantages:

8.1.0.1Historical context.

The models in this chapter build on a long tradition: Bewley (1986) introduced precautionary savings with borrowing constraints; Huggett (1993) studied endowment economies with incomplete markets; Aiyagari (1994) added production and general equilibrium; and Krusell & Smith (1998) incorporated aggregate uncertainty. Achdou et al. (2022) reformulated these models in continuous time and demonstrated that finite-difference methods can solve the coupled HJB--KFE system efficiently. More recently, Gu et al. (2024) introduced EMINNs to solve the master equation globally, enabling treatment of aggregate shocks without moment-based approximations.

8.2Stochastic Calculus Refresher

We briefly review the stochastic calculus tools needed for continuous-time models; for a standard finance-oriented textbook treatment, see Shreve (2004).

8.2.0.1Quick reference.

Appendix Appendix C contains a one-page summary of the same material (Brownian motion, Itô’s lemma, ergodicity in one paragraph) for readers who want a compact reminder rather than the full exposition below.

8.2.1Brownian Motion

Key properties include E ⁣[Bt]=0\E{B_t} = 0, Var(Bt)=t\mathrm{Var}(B_t) = t, nowhere-differentiable paths, and quadratic variation Bt=t\langle B \rangle_t = t. Brownian motion arises as the scaling limit of a random walk: if Xt+Δt=Xt+ΔtεtX_{t+\Delta t} = X_t + \sqrt{\Delta t}\,\varepsilon_t with εt{1,+1}\varepsilon_t \in \{-1,+1\} equiprobably, then XΔtdBtX^{\Delta t} \xrightarrow{d} B_t as Δt0\Delta t \to 0 (Donsker’s theorem). The Δt\sqrt{\Delta t} scaling ensures that Var(Xt)=t\mathrm{Var}(X_t) = t in the limit. Figure Figure 8.1 shows three discretized sample paths with the same variance scaling.

Three simulated standard Brownian sample paths \{B_t\}_{t\in[0,1]}, generated with discretization step \Delta t = 0.05 and Gaussian increments B_{t+\Delta t} = B_t + \sqrt{\Delta t}\,\varepsilon_t, \varepsilon_t \sim \mathcal{N}(0,1). Paths are jagged at the chosen \Delta t; limiting Brownian paths are continuous almost surely but nowhere differentiable, with \mathrm{Var}(B_t) = t.

Figure 8.1:Three simulated standard Brownian sample paths {Bt}t[0,1]\{B_t\}_{t\in[0,1]}, generated with discretization step Δt=0.05\Delta t = 0.05 and Gaussian increments Bt+Δt=Bt+ΔtεtB_{t+\Delta t} = B_t + \sqrt{\Delta t}\,\varepsilon_t, εtN(0,1)\varepsilon_t \sim \mathcal{N}(0,1). Paths are jagged at the chosen Δt\Delta t; limiting Brownian paths are continuous almost surely but nowhere differentiable, with Var(Bt)=t\mathrm{Var}(B_t) = t.

8.2.2Itô Processes and SDEs

An Itô process XtX_t satisfies the stochastic differential equation (SDE):

dXt=μ(Xt,t)dt+σ(Xt,t)dBt,dX_t = \mu(X_t, t)\,dt + \sigma(X_t, t)\,dB_t,

where μ()\mu(\cdot) is the drift (deterministic trend) and σ()\sigma(\cdot) is the diffusion coefficient (volatility). Readers unfamiliar with Itô calculus will benefit from Shreve (2004) as a prerequisite; the key fact (dBt)2=dt(dB_t)^2 = dt is what forces the second-order term in Itô’s lemma below. Two important special cases recur throughout this chapter:

For discrete income switching, we use a continuous-time Markov chain: a labor state nt{n1,n2}n_t \in \{n_1, n_2\} that switches with Poisson intensities λ1\lambda_1 (from n1n_1 to n2n_2) and λ2\lambda_2 (from n2n_2 to n1n_1), yielding ergodic probabilities π1=λ2/(λ1+λ2)\pi_1 = \lambda_2/(\lambda_1 + \lambda_2) and π2=λ1/(λ1+λ2)\pi_2 = \lambda_1/(\lambda_1 + \lambda_2).

8.2.3Itô’s Lemma

The key difference from ordinary calculus is the second-order correction 12fσ2dt\tfrac{1}{2}f''\sigma^2\,dt, which arises because (dBt)2=dt0(dB_t)^2 = dt \neq 0. The differential algebra rules are: dtdt=0dt \cdot dt = 0, dtdBt=0dt \cdot dB_t = 0, dBtdBt=dtdB_t \cdot dB_t = dt.

8.2.3.1Worked example.

For GBM dXt=μXtdt+σXtdBtdX_t = \mu X_t\,dt + \sigma X_t\,dB_t, applying Itô’s lemma to f(x)=lnxf(x) = \ln x gives d(lnXt)=(μ12σ2)dt+σdBtd(\ln X_t) = (\mu - \tfrac{1}{2}\sigma^2)\,dt + \sigma\,dB_t, so Xt=X0exp[(μ12σ2)t+σBt]X_t = X_0\exp[(\mu - \tfrac{1}{2}\sigma^2)t + \sigma B_t]. The 12σ2-\tfrac{1}{2}\sigma^2 Itô correction explains why the expected log return differs from the expected return for volatile assets.

8.2.3.2Time-dependent version.

For V(Xt,t)V(X_t, t) where dXt=μdt+σdBtdX_t = \mu\,dt + \sigma\,dB_t:

dV=[tV+μxV+12σ2xxV]dt+σxVdBt.dV = \left[\partial_t V + \mu\,\partial_x V + \tfrac{1}{2}\sigma^2\,\partial_{xx} V\right]dt + \sigma\,\partial_x V\,dB_t.

With Poisson jumps of intensity λ\lambda and jump size ΔX\Delta X, an additional term [V(Xt+ΔX,t)V(Xt,t)]dNt[V(X_{t^-} + \Delta X, t) - V(X_{t^-}, t)]\,dN_t appears.

8.3The Kolmogorov Forward Equation

The Kolmogorov forward equation (KFE), also known as the Fokker--Planck equation, describes how the probability density of a stochastic process evolves over time. It was introduced by Kolmogorov (1931) and, independently in the physics literature, by Fokker (1914) and Planck (1917) to describe diffusion of particles. In stationary equilibrium, tg=0\partial_t g = 0 and the KFE reduces to an elliptic PDE for the cross-sectional density (used throughout Section 8.5--Section 8.6); when aggregate shocks make prices time-varying, the parabolic time-dependent form returns and motivates the master-equation reformulation of Section 8.7.

8.3.1Derivation from First Principles

Consider a population of particles, each independently following dXt=μdt+σdBtdX_t = \mu\,dt + \sigma\,dB_t with constant coefficients. If the initial density is g0(x)g_0(x), what is the density g(x,t)g(x,t) at time t>0t > 0?

The derivation proceeds in four steps. (i) For any smooth test function φ(x)\varphi(x), E ⁣[φ(Xt)]=φ(x)g(x,t)dx\E{\varphi(X_t)} = \int \varphi(x)\,g(x,t)\,dx. (ii) Differentiate with respect to tt and apply Itô’s lemma: ddtφgdx=[μφ+σ22φ]gdx\tfrac{d}{dt}\int \varphi\,g\,dx = \int [\mu\,\varphi' + \tfrac{\sigma^2}{2}\varphi'']\,g\,dx. (iii) Integrate by parts. Take φ\varphi to be compactly supported: this kills the boundary terms cleanly and costs nothing here, since the identity must hold for every such φ\varphi. We obtain μφgdx=φμxgdx\int \mu\,\varphi'\,g\,dx = -\int \varphi\,\mu\,\partial_x g\,dx and σ22φgdx=φσ22xxgdx\int \tfrac{\sigma^2}{2}\varphi''\,g\,dx = \int \varphi\,\tfrac{\sigma^2}{2}\partial_{xx}g\,dx. (The natural-looking assumption g0g \to 0 at ±\pm\infty is automatic for any continuous density, but it is not by itself enough: what is needed is that the product gφg\,\varphi vanishes at infinity, which compact support of φ\varphi delivers for free. Spatial boundaries, e.g. a borrowing constraint, require separate treatment in the next subsection.) (iv) Since the identity holds for all test functions φ\varphi, we obtain:

gt(x,t)=μgx(x,t)+σ222gx2(x,t).\boxed{\frac{\partial g}{\partial t}(x,t) = -\mu\frac{\partial g}{\partial x}(x,t) + \frac{\sigma^2}{2}\frac{\partial^2 g}{\partial x^2}(x,t).}

The two terms on the right encode competing effects: μxg-\mu\,\partial_x g is advection (drift transports the density), and σ22xxg\tfrac{\sigma^2}{2}\partial_{xx}g is diffusion (noise spreads the density).

8.3.1.1General form.

For state-dependent coefficients dXt=μ(Xt)dt+σ(Xt)dBtdX_t = \mu(X_t)\,dt + \sigma(X_t)\,dB_t, the KFE in divergence form is:

tg=x ⁣[μ(x)g(x,t)]+12xx ⁣[σ(x)2g(x,t)]=xJ(x,t),\partial_t g = -\partial_x\!\left[\mu(x)\,g(x,t)\right] + \tfrac{1}{2}\partial_{xx}\!\left[\sigma(x)^2\,g(x,t)\right] = -\partial_x J(x,t),

where J=μg12x(σ2g)J = \mu g - \tfrac{1}{2}\partial_x(\sigma^2 g) is the probability flux. The identity tg+xJ=0\partial_t g + \partial_x J = 0 is a conservation law: probability is neither created nor destroyed. When σ\sigma depends on xx, the diffusion coefficient must be written inside the second derivative; in particular, 12xx[σ(x)2g]σ(x)22xxg\tfrac{1}{2}\partial_{xx}[\sigma(x)^2\,g] \neq \tfrac{\sigma(x)^2}{2}\partial_{xx}g, with the two expressions differing by (σ2)xg+12(σ2)g(\sigma^2)'\,\partial_x g + \tfrac{1}{2}(\sigma^2)''\,g. This distinction is invisible in the constant-coefficient case but is what keeps the operator self-adjoint and probability-conserving when σ\sigma varies.

8.3.2Examples

8.3.2.1Heat equation.

With μ=0\mu = 0 and constant σ\sigma, the KFE reduces to tg=σ22xxg\partial_t g = \tfrac{\sigma^2}{2}\partial_{xx}g, the classical heat equation. Starting from a point mass g(x,0)=δ(xx0)g(x,0) = \delta(x-x_0), the solution is a Gaussian with variance growing linearly: g(x,t)=(2πσ2t)1/2exp[(xx0)2/(2σ2t)]g(x,t) = (2\pi\sigma^2 t)^{-1/2}\exp[-(x-x_0)^2/(2\sigma^2 t)].

8.3.2.2Ornstein--Uhlenbeck process.

For dXt=η(xˉXt)dt+σdBtdX_t = \eta(\bar{x} - X_t)\,dt + \sigma\,dB_t, the KFE is tg=ηx[(xxˉ)g]+σ22xxg\partial_t g = \eta\,\partial_x[(x - \bar{x})\,g] + \tfrac{\sigma^2}{2}\partial_{xx}g. Setting tg=0\partial_t g = 0 and trying a Gaussian ansatz g(x)=(2πs2)1/2exp ⁣[(xxˉ)2/(2s2)]g^\star(x) = (2\pi s^2)^{-1/2}\exp\!\bigl[-(x-\bar x)^2/(2s^2)\bigr], the advection and diffusion terms balance when s2=σ2/(2η)s^2 = \sigma^2/(2\eta), giving the stationary distribution g(x)=N(xˉ,σ2/(2η))g^*(x) = \mathcal{N}(\bar{x}, \sigma^2/(2\eta)): mean reversion concentrates mass around xˉ\bar{x}, while diffusion spreads it, and the balance produces a Gaussian steady state.

8.3.2.3Reading the SDE qualitatively.

It is worth pausing to read the drift sign by eye, because students are often trained to compute with differential equations but rarely to look at them. When Xt<xˉX_t < \bar{x}, the drift η(xˉXt)\eta(\bar{x} - X_t) is positive and pushes XtX_t upward; when Xt>xˉX_t > \bar{x}, the drift is negative and pushes XtX_t downward, hence the name mean-reverting. Flipping the sign (η<0\eta < 0) gives a mean-repelling, unstable process that drifts away from xˉ\bar{x} without bound. Closely related cubic SDEs make the same point sharply. The process dXt=Xt3dt+σdBtdX_t = -X_t^3\,dt + \sigma\,dB_t uses the cubic well as a restoring force and is well-posed with a stationary distribution, while dXt=+Xt3dt+σdBtdX_t = +X_t^3\,dt + \sigma\,dB_t blows up in finite time, and a naive Euler discretization produces NaNs almost immediately. Throughout this chapter the same qualitative reading is what carries intuition over from SDEs to KFEs and HJBs.

8.3.3From Physics to Economics: A Continuum of Agents

Consider a continuum of agents i[0,1]i \in [0,1], each independently following dXti=μ(Xti)dt+σ(Xti)dBtidX_t^i = \mu(X_t^i)\,dt + \sigma(X_t^i)\,dB_t^i with independent idiosyncratic Brownian motions BtiB_t^i. By the law of large numbers at the population level, the cross-sectional density g(x,t)g(x,t) evolves deterministically, even though each individual path is random. The density satisfies the KFE (8.5).

8.3.3.1KFE with income switching.

When agent ii has wealth atia_t^i and income state nti{n1,n2}n_t^i \in \{n_1, n_2\} switching with Poisson intensities, and wealth evolves as dati=s(ati,nti)dtda_t^i = s(a_t^i, n_t^i)\,dt with atiaa_t^i \geq \underline{a}, the cross-sectional density gt(a,n)g_t(a,n) satisfies:

tgt(a,n)=a ⁣[s(a,n)gt(a,n)]λ(n)gt(a,n)+λ(n^)gt(a,n^),\partial_t g_t(a,n) = -\partial_a\!\left[s(a,n)\,g_t(a,n)\right] - \lambda(n)\,g_t(a,n) + \lambda(\hat{n})\,g_t(a,\hat{n}),

where n^\hat{n} denotes the complementary income state. The three terms represent: flow of agents along the wealth axis (savings), agents leaving state nn, and agents entering state nn from n^\hat{n}.

8.3.3.2Boundaries and mass points.

At the borrowing constraint a=aa = \underline{a}, the no-flux boundary condition s(a,n)gt(a,n)=0s(\underline{a},n)\,g_t(\underline{a},n) = 0 prevents the absolutely continuous density from flowing below a\underline{a}. If households are constrained at this boundary, a boundary atom may be needed in addition to the interior density; finite-difference implementations represent that atom as mass in the first grid cell. This is the continuous-time counterpart of the characteristic left spike observed in empirical wealth distributions.

8.3.3.3When does the KFE become stochastic?

With purely idiosyncratic shocks (Aiyagari), the KFE is deterministic. When aggregate shocks are present (Krusell--Smith), prices rt,wtr_t, w_t depend on the aggregate state ZtZ_t, making the drift stochastic and the density gtg_t a stochastic process adapted to the filtration Ft0\mathcal{F}_t^0 generated by the aggregate Brownian motion. This is the “master equation” setting discussed in Section Section 8.7.

8.4The Hamilton--Jacobi--Bellman Equation

Individual optimality in continuous-time heterogeneous-agent models is characterized by the HJB equation. This section gives the full five-step derivation from Itô’s lemma; readers who saw the motivating overview of the continuous-time heterogeneous-agent setting in Section 7.7 can treat the present section as its formal counterpart.

8.4.0.1The agent’s problem.

Agent ii with state xti=(ati,nti)x_t^i = (a_t^i, n_t^i) chooses consumption ctic_t^i to maximize:

max{cti}  E ⁣[0eρtu(cti)dt]\max_{\{c_t^i\}} \;\E{\int_0^\infty e^{-\rho t}\,u(c_t^i)\,dt}

subject to dati=(wnti+raticti)dtda_t^i = (wn_t^i + ra_t^i - c_t^i)\,dt and atiaa_t^i \geq \underline{a}, where u(c)=c1γ/(1γ)u(c) = c^{1-\gamma}/(1-\gamma) is CRRA utility, ρ>0\rho > 0 is the discount rate, and (r,w)(r,w) are factor prices. The standard transversality condition limteρtV(ati,nti)=0\lim_{t\to\infty} e^{-\rho t}\,V(a_t^i, n_t^i) = 0 along optimal paths, the continuous-time no-Ponzi requirement, is imposed throughout.

8.4.0.2The value function.

The value function V(a,n)V(a,n) records the maximum expected discounted utility starting from state (a,n)(a,n). It is increasing and concave in aa, and V(a,n2)>V(a,n1)V(a,n_2) > V(a,n_1) when n2>n1n_2 > n_1.

8.4.0.3Deriving the HJB.

The derivation follows five steps; each unpacks one ingredient of equation (8.11) below.

Step (i): Dynamic programming principle. For small h>0h > 0,

V(a,n)  =  maxc{0heρtu(ct)dt  +  eρhE ⁣[V(ah,nh)]}.V(a,n) \;=\; \max_c\Big\{\int_0^h e^{-\rho t}\,u(c_t)\,dt \;+\; e^{-\rho h}\,\E{V(a_h, n_h)}\Big\}.

This is Bellman’s principle of optimality applied to a continuous-time problem.

Step (ii): Itô’s lemma between income jumps. Conditional on the income state ntn_t not changing on [0,h][0, h], wealth follows the deterministic ODE dat=s(ct,at,nt)dtda_t = s(c_t, a_t, n_t)\,dt (there is no Brownian forcing on wealth in this model), so

dV=V(a,n)s(c,a,n)dt.dV = V'(a,n)\,s(c,a,n)\,dt.

The second-order Itô correction 12Vσ2dt\tfrac{1}{2}V''\sigma^2\,dt vanishes because the wealth diffusion is zero between jumps; this is the most subtle step and is what distinguishes the income-switching HJB from a standard diffusion HJB.

Step (iii): Account for Poisson jumps in expectation. Adding the Poisson-jump contribution and taking expectations,

E ⁣[dV]=[V(a,n)s+λ(n)(V(a,n^)V(a,n))]dt,\E{dV} = \Big[V'(a,n)\,s + \lambda(n)\bigl(V(a,\hat{n}) - V(a,n)\bigr)\Big]\,dt,

where λ(n)\lambda(n) is the intensity of switching out of state nn and n^\hat{n} is the complementary state.

Step (iv): Substitute into the DPP and let h0h \to 0. Plugging the expectation back into the Bellman expression, dividing by hh, and taking h0h \to 0 yields a flow equation in which the discount ρV\rho V on the left balances the flow utility plus expected change on the right.

Step (v): Optimize over cc. Imposing the first-order condition over consumption gives the HJB equation:

ρV(a,n)=maxc{u(c)+V(a,n)(wn+rac)+λ(n) ⁣(V(a,n^)V(a,n))}.\boxed{\rho V(a,n) = \max_c\left\{u(c) + V'(a,n)\cdot(wn + ra - c) + \lambda(n)\!\left(V(a,\hat{n}) - V(a,n)\right)\right\}.}

8.4.0.4Interpretation.

The HJB is an asset pricing equation: the left side ρV\rho V is the “required return” on the value function (discount rate times “asset value”), and the right side is the “total return” consisting of the flow dividend u(c)u(c), the capital gain VsV' \cdot s from saving, and the expected gain/loss λ(n)(ΔV)\lambda(n)(\Delta V) from income switching.

8.4.0.5Optimal policy.

The first-order condition u(c)=V(a,n)u'(c^*) = V'(a,n) gives the consumption function:

c(a,n)=[V(a,n)]1/γ.c^*(a,n) = \left[V'(a,n)\right]^{-1/\gamma}.

Substituting back eliminates the maximization, yielding a nonlinear PDE in VV. The savings function is s(a,n)=wn+rac(a,n)s(a,n) = wn + ra - c^*(a,n).

8.4.0.6Boundary conditions.

At the borrowing constraint a=aa = \underline{a}, consumption must keep the drift feasible: s(a,n)=wn+rac0s(\underline{a},n)=wn+r\underline{a}-c \geq 0, or equivalently cwn+rac \leq wn+r\underline{a}. The boundary HJB is therefore the constrained maximization

ρV(a,n)=max0<cwn+ra{u(c)+Va(a,n)(wn+rac)+λ(n)(V(a,n^)V(a,n))}.\begin{aligned} \rho V(\underline{a},n) &=\max_{0<c\leq wn+r\underline{a}} \Big\{u(c)+V_a(\underline{a},n)(wn+r\underline{a}-c)\\ &\qquad\qquad\qquad\qquad +\lambda(n)\bigl(V(\underline{a},\hat n)-V(\underline{a},n)\bigr)\Big\}. \end{aligned}

For CRRA utility this gives the boundary policy c(a,n)=min{[Va(a,n)]1/γ,wn+ra}c^*(\underline{a},n)=\min\{[V_a(\underline{a},n)]^{-1/\gamma},\,wn+r\underline{a}\} and s(a,n)0s(\underline{a},n)\geq 0. This is the state-constraint form of the borrowing limit; numerical solvers usually impose it with one-sided derivatives, a constrained policy rule, or a penalty on negative boundary drift.

8.4.0.7Boundary atoms in the stationary distribution.

When the borrowing constraint binds on a positive mass of agents, the stationary measure is not absolutely continuous with respect to Lebesgue measure: it carries a Dirac atom at a=aa=\underline a. The decomposition is g(a,n)=gac(a,n)+α(n)δ(aa)g(a,n) = g_{\mathrm{ac}}(a,n) + \alpha(n)\,\delta(a-\underline a), where gacg_{\mathrm{ac}} is the absolutely-continuous interior density and α(n)0\alpha(n)\geq 0 is the constrained mass for income state nn. The KFE (8.6) as written governs only the interior part gacg_{\mathrm{ac}}; the atomic mass α(n)\alpha(n) is determined by a separate flux-balance equation that equates inflows from the no-flux boundary condition with the income-driven outflow back into the interior. Finite-difference implementations typically represent α(n)\alpha(n) as the mass in the first grid cell, and PINN implementations either absorb the atom implicitly into a smooth density approximation (with corresponding accuracy loss near a\underline a) or explicitly parameterize α(n)\alpha(n) alongside the interior network.

8.4.0.8Variant: continuous (diffusion) income.

A natural variant replaces the two-state Poisson process with a continuously distributed earnings state ztz_t following an Ornstein--Uhlenbeck diffusion, dzt=η(zˉzt)dt+σdBtzdz_t = \eta(\bar z - z_t)\,dt + \sigma\,dB_t^z (with idiosyncratic Brownian motion BtzB_t^z). The agent’s state is then (a,z)(a,z), the value function V(a,z)V(a,z) is smooth in both arguments, and Itô’s lemma along the zz-diffusion produces a genuine second-order term. After substituting the first-order condition c=(Va)1/γc^\star=(V_a)^{-1/\gamma} the HJB becomes the elliptic PDE

ρV(a,z)=u(c)+Va(wz+rac)+η(zˉz)Vz+12σ2Vzz,\rho V(a,z) = u(c^\star) + V_a\,(wz + ra - c^\star) + \eta(\bar z - z)\,V_z + \tfrac{1}{2}\sigma^2\,V_{zz},

with the borrowing-constraint state condition s(a,z)0s(\underline a,z)\geq 0 at a=aa=\underline a, a Neumann (FOC) condition Va(aˉ,z)=u(wz+raˉ)V_a(\bar a,z)=u'(w z + r\bar a) on the truncated upper wealth boundary, and reflecting conditions Vz=0V_z=0 at the zz-boundaries. This is the smallest model in the chapter that carries the diffusion second-order term 12σ2Vzz\tfrac{1}{2}\sigma^2 V_{zz} in the individual HJB: the income-switching HJB (8.11) has none, because wealth carries no Brownian forcing between jumps, while the master equation (8.16) carries 12(σz)2Vzz\tfrac{1}{2}(\sigma^z)^2 V_{zz} only for the aggregate TFP state zz.

8.5Competitive Equilibrium: Huggett and Aiyagari

The HJB gives individual optimal behavior for given prices; the KFE tracks the resulting distribution. Market clearing pins down prices, closing the system. Figure Figure 8.2 summarizes this fixed-point structure.

8.5.1The Coupled HJB--KFE System

Stationary continuous-time heterogeneous-agent equilibrium as a coupled HJB--KFE--market-clearing loop. Given prices, the HJB determines optimal savings; the KFE maps that policy into a stationary density; aggregating the density updates capital, labor, and therefore prices.

Figure 8.2:Stationary continuous-time heterogeneous-agent equilibrium as a coupled HJB--KFE--market-clearing loop. Given prices, the HJB determines optimal savings; the KFE maps that policy into a stationary density; aggregating the density updates capital, labor, and therefore prices.

The solution method for the stationary equilibrium (no aggregate shocks) iterates: guess rr \to solve HJB for V,cV, c^* \to solve KFE for gg^* \to compute K=nagdaK = \sum_n \int a\,g^*\,da \to update rr from the firm FOC. Under standard regularity conditions on preferences, technology, and the income process, aggregate capital supply Ks(r)K^s(r) is monotone decreasing in rr over the relevant range, which makes the bisection (or fixed-point iteration) on rr well-posed; see Achdou et al. (2022) [§2] for the full statement.

8.5.2Huggett (1993): Endowment Economy

Huggett’s model is an endowment economy with idiosyncratic income yt{y1,y2}y_t \in \{y_1, y_2\}, a single risk-free bond btbb_t \geq \underline{b} paying instantaneous return rr, and bonds in zero net supply. The HJB is ρV=maxc{u(c)+Vb(rb+yc)+λ(y)(ΔV)}\rho V = \max_c\{u(c) + V_b(rb + y - c) + \lambda(y)(\Delta V)\}, and the KFE determines the stationary density g(b,y)g^*(b,y). An equilibrium return rr^* is a value satisfying the asset-market-clearing condition ybg(b,y)db=0\sum_y \int b\,g^*(b,y)\,db = 0; uniqueness requires standard monotonicity assumptions on aggregate bond demand Achdou et al., 2022.

The mechanism is that the risk-free rate is pinned down by precautionary self-insurance demand, not by a production FOC: agents desire to hold positive bond positions for precautionary reasons, and the return must adjust downward until bond demand equals zero net supply.

8.5.3Aiyagari (1994): Production Economy

Aiyagari’s model adds a representative firm with Cobb--Douglas production Y=KαL1αY = K^\alpha L^{1-\alpha}. The household asset is now a claim on aggregate capital, and the firm’s FOCs yield r=αKα1L1αδr = \alpha K^{\alpha-1}L^{1-\alpha} - \delta and w=(1α)KαLαw = (1-\alpha)K^\alpha L^{-\alpha}. The equilibrium condition is Ks(r)=Kd(r)K^s(r) = K^d(r), where Ks(r)=zag(a,z)daK^s(r) = \sum_z \int a\,g^*(a,z)\,da is capital supplied by households (via HJB + KFE) and Kd(r)K^d(r) is capital demanded by the firm (inverse of the firm FOC). Table Table 8.1 highlights the key distinction between the endowment and production versions.

8.5.3.1What changes from Huggett to Aiyagari?

Both models share the same household problem (HJB) and the same cross-sectional law of motion (KFE). What differs is the equilibrium concept. In Huggett the equilibrium is the single price rr^\star that clears a zero-net-supply bond market, ybg(b,y)db=0\sum_y\int b\,g^\star(b,y)\,db = 0; the rate is pinned down by precautionary self-insurance demand alone, with no production side. In Aiyagari the equilibrium is a fixed point in rr that matches household supply Ks(r)K^s(r) to firm demand Kd(r)=(α/(r+δ))1/(1α)LK^d(r) = (\alpha/(r+\delta))^{1/(1-\alpha)} L, with prices determined jointly by household savings and the firm FOCs. Numerically, both reduce to a one-dimensional root-finding problem in rr, but the economic mechanism (precautionary saving vs. marginal-product-of-capital pinning) is qualitatively different.

8.5.3.2Adding aggregate TFP.

When aggregate TFP ZtZ_t is allowed to vary (e.g., the OU process introduced in Section 8.7 below for Krusell--Smith), the firm FOCs generalize to rt=αeZtKtα1Lt1αδr_t = \alpha\, e^{Z_t} K_t^{\alpha-1}L_t^{1-\alpha} - \delta and wt=(1α)eZtKtαLtαw_t = (1-\alpha)\, e^{Z_t} K_t^\alpha L_t^{-\alpha}. Aiyagari is recovered when Zt0Z_t \equiv 0; the same expression covers both calibrations, which is convenient for the master-equation analysis below.

Table 8.1:Huggett and Aiyagari as two continuous-time incomplete-markets benchmarks. Huggett clears a zero-net-supply bond market by adjusting the bond return; Aiyagari clears a positive capital market with prices pinned down by firm first-order conditions.

Huggett (1993)Aiyagari (1994)
EconomyEndowmentProduction (Y=KαL1αY = K^\alpha L^{1-\alpha})
AssetBond bbCapital claim aa
Net supplyZero (bg=0\int b\,g = 0)Positive (ag=K>0\int a\,g = K > 0)
Price determined byBond return qqInterest rate rr, wage ww
Wealth distributionCentered around 0, mass at b\underline{b}Right-skewed, long right tail

Figure Figure 8.3 contrasts the two stationary densities visually. In Huggett (left), bonds are in zero net supply, so the cross-sectional density is centred near b ⁣= ⁣0b\!=\!0, with a Dirac atom at the borrowing limit b\underline{b} carried entirely by constrained low-productivity households; high-productivity households are smoothly distributed and never bind. In Aiyagari (right), agents hold positive capital in equilibrium, so the same atom now sits at a ⁣= ⁣0\underline{a}\!=\!0 but the bulk of the mass is shifted right with a long upper tail.

Stationary cross-sectional densities g^* in the two benchmarks, by productivity type n\in\{n_1,n_2\} (low and high). In both economies, only the constrained low-productivity type n_1 supports a Dirac atom at the borrowing constraint (blue spike): high-productivity households are not bound. Left: Huggett, bonds with limit \underline{b}=-2 and zero net supply, so the bulk of mass sits around b=0. Right: Aiyagari, capital with limit \underline{a}=0 and positive aggregate K, shifting the unconstrained mass to the right with a long upper tail. The blue spikes visualize the Dirac atom \alpha(n_1)\,\delta(a-\underline a) in the decomposition g = g_{\mathrm{ac}} + \alpha(n)\,\delta(a-\underline a) introduced in the boundary-atom paragraph above. These curves are schematic TikZ illustrations of the qualitative contrast (zero-net-supply bonds versus positive capital), not direct exports; the exact densities depend on calibration and boundary treatment.

Figure 8.3:Stationary cross-sectional densities gg^* in the two benchmarks, by productivity type n{n1,n2}n\in\{n_1,n_2\} (low and high). In both economies, only the constrained low-productivity type n1n_1 supports a Dirac atom at the borrowing constraint (blue spike): high-productivity households are not bound. Left: Huggett, bonds with limit b=2\underline{b}=-2 and zero net supply, so the bulk of mass sits around b=0b=0. Right: Aiyagari, capital with limit a=0\underline{a}=0 and positive aggregate KK, shifting the unconstrained mass to the right with a long upper tail. The blue spikes visualize the Dirac atom α(n1)δ(aa)\alpha(n_1)\,\delta(a-\underline a) in the decomposition g=gac+α(n)δ(aa)g = g_{\mathrm{ac}} + \alpha(n)\,\delta(a-\underline a) introduced in the boundary-atom paragraph above. These curves are schematic TikZ illustrations of the qualitative contrast (zero-net-supply bonds versus positive capital), not direct exports; the exact densities depend on calibration and boundary treatment.

8.5.3.3Connection to HANK.

These models are the building blocks of Heterogeneous Agent New Keynesian (HANK) models Kaplan et al., 2018, which replace the representative agent in New Keynesian frameworks with an Aiyagari economy. Adding nominal rigidities allows monetary policy to affect consumption heterogeneously: agents near the borrowing constraint have high marginal propensities to consume and respond strongly to fiscal stimulus, while wealthy agents absorb shocks through savings.

8.6A PINN Solver for the Stationary Huggett--Aiyagari System

The stationary equilibrium of Section 8.5 couples five conditions: the HJB equation for the value function V(a,z)V(a,z), the consumption first-order condition c(a,z)=(V(a,z))1/γc^\star(a,z) = \big(V'(a,z)\big)^{-1/\gamma}, the KFE for the stationary density g(a,z)g(a,z) with savings drift s(a,z)=wz+rac(a,z)s(a,z) = wz + ra - c^\star(a,z), the no-flux boundary condition s(a,z)g(a,z)=0s(\underline a, z)\,g(\underline a, z) = 0 at the borrowing constraint a\underline a, mass normalization zg(a,z)da=1\sum_z\int g(a,z)\,da = 1, and the market-clearing condition that pins down prices. The traditional solver iterates a fixed point over rr (guess rr \to solve HJB for V,cV, c^\star \to solve KFE for gg \to aggregate capital \to update rr from the firm FOC); a PINN instead trains all of them jointly.

A PINN implementation uses two networks, trained jointly:

The joint loss has four components:

=wHJBHJB+wKFEKFE+wfluxflux+wmass(zg^ψ(a,z)da1) ⁣2,\ell = w_{\mathrm{HJB}}\,\ell_{\mathrm{HJB}} + w_{\mathrm{KFE}}\,\ell_{\mathrm{KFE}} + w_{\mathrm{flux}}\,\ell_{\mathrm{flux}} + w_{\mathrm{mass}}\left(\sum_z\int \hat{g}_\psi(a,z)\,da - 1\right)^{\!2},

where HJB\ell_{\mathrm{HJB}} and KFE\ell_{\mathrm{KFE}} are mean squared PDE residuals computed on collocation points, flux\ell_{\mathrm{flux}} enforces the no-flux boundary conditions s(a,z)g^ψ(a,z)=0s(\underline a, z)\,\hat g_\psi(\underline a, z) = 0, and the mass term enforces normalization. The integral is evaluated numerically (quadrature or Monte Carlo on the collocation points). The aggregate-flux identity zs(a,z)g(a,z)=0\sum_z s(a,z)\,g(a,z) = 0 at each interior aa -- which follows from the no-flux boundary and total-mass conservation within each aa-slice -- is a free consistency check at solution time and is sometimes added as an auxiliary loss term.

Balancing the four loss components is critical: the HJB and KFE residuals can differ by orders of magnitude, so adaptive loss balancing (ReLoBRaLo, Chapter Chapter 4) is strongly recommended. Practical considerations include using separate learning-rate schedules for the two networks, concentrating collocation points near the borrowing constraint where the density can become sharply peaked, and verifying that the consumption policy c^\hat c^\star satisfies c^>0\hat c^\star > 0 everywhere. If the true stationary distribution contains an atom at the borrowing constraint (as in both Huggett and Aiyagari, Figure Figure 8.3), a continuous density network alone cannot represent it; one must add a separate boundary-mass variable or use a discretization that permits a point mass.

This continuous-time PINN approach and the discrete-time DEQN with Young’s method (Chapter Chapter 6) address the same economic question -- how heterogeneous agents interact through prices when markets are incomplete -- but differ in the mathematical formulation summarized in Table Table 8.2.

Table 8.2:Discrete- and continuous-time formulations of incomplete-markets heterogeneous-agent models. The economic object is the same in both columns, but the numerical residual changes from a discrete-time law of motion plus Euler equation to a coupled HJB--KFE PDE system.

Discrete time (Ch. Chapter 6)Continuous time (this chapter)
DistributionHistogram Gt(ki,εj)G_t(k_i, \varepsilon_j)Density g(a,z)g(a,z)
EvolutionYoung’s redistributionKFE PDE
Individual opt.Euler equationHJB PDE
SolverDEQN (TensorFlow)PINN (PyTorch)
Key referenceKrusell & Smith (1998)Achdou et al. (2022)

Both approaches can incorporate aggregate shocks, multiple assets, and general equilibrium; the choice between them depends primarily on whether the underlying economic model is formulated in discrete or continuous time. For the aggregate-shock case the natural continuous-time object is the master equation (Section 8.7), solved with EMINNs (Section 8.8).

8.7The Master Equation

When aggregate TFP ZtZ_t follows an OU process dZt=η(ZˉZt)dt+σzdBt0dZ_t = \eta(\bar{Z} - Z_t)\,dt + \sigma^z\,dB_t^0 (with mean-reversion speed η>0\eta>0; not the OLG TFP shock or the network learning rate of earlier chapters), the value function depends on the entire wealth distribution: V=V(a,n,z,g)V = V(a, n, z, g). The HJB becomes a PDE with a functional argument, and the “curse of infinite dimensionality” strikes: the functional derivative δV/δg\delta V/\delta g makes the problem intractable by standard methods. The master equation approach, which originated in the mean field games literature Lasry & Lions, 2007 and is developed systematically in the monograph of Cardaliaguet et al. (2019), reformulates this coupled HJB--KFE system as a single PDE on the extended state space (a,n,z,g)(a, n, z, g) that retains the distribution argument explicitly but is amenable to neural network approximation.

8.7.0.1Why collapse the coupled system?

Without aggregate shocks, solving the stationary equilibrium as a fixed point in rr over the coupled HJB--KFE system is straightforward (Section 8.5). With aggregate shocks, however, every realization of ZtZ_t would in principle require its own coupled solve, and no parametric guess for V(a,n,z,g)V(a,n,z,g) can be informed by the cross-section unless the cross-section is treated as an explicit argument. The master equation reformulation lifts gg into the state space so a single PDE in (a,n,z,g)(a,n,z,g) encodes the entire economy, which makes a global neural-network ansatz feasible (Section Section 8.8). The price of this convenience is the appearance of the functional-derivative term δV/δg\delta V/\delta g, which the rest of this section unpacks.

8.7.0.2The master equation.

The key idea is to substitute the KFE, market clearing, and belief consistency directly into the HJB, collapsing the coupled system into a single PDE:

0=ρV(a,n,z,g)+u(c)+Va[w(z,g)n+r(z,g)ac]+λ(n) ⁣(V(a,n^,z,g)V(a,n,z,g))+Vzμz(z)+12(σz)2Vzz+jaδVδgj(a,n,z,g)(y)  μjg(y,z,g)dy,\begin{split} 0 &= -\rho V(a,n,z,g) + u(c^*) + V_a\left[w(z,g)n + r(z,g)a - c^*\right] \\ &\quad + \lambda(n)\!\left(V(a,\hat{n},z,g) - V(a,n,z,g)\right) + V_z\,\mu^z(z) + \tfrac{1}{2}(\sigma^z)^2 V_{zz} \\ &\quad + \sum_{j} \int_{\underline{a}}^{\infty} \frac{\delta V}{\delta g_j}(a,n,z,g)(y)\;\mu^g_j(y,z,g)\,dy, \end{split}

where μjg\mu^g_j is the KFE drift computed from the optimal savings policy, and the last line encodes how changes in the distribution affect the value function through prices. The kernel δV/δgj(y)\delta V/\delta g_j(y) is the infinite-dimensional analogue of a gradient: it measures how the value function at the individual state (a,n,z)(a,n,z) responds to an infinitesimal redistribution of probability mass to wealth level yy in the cross-section; the remark below makes this precise. Mass conservation guarantees aμjg(y,z,g)dy=0\int_{\underline a}^{\infty}\mu^g_j(y,z,g)\,dy = 0 (the KFE flux integrates to zero under no-flux boundary conditions), so the integrand of the last line pairs δV/δgj\delta V/\delta g_j with a mean-zero test perturbation in exactly the sense required by the functional-derivative remark below.

8.7.0.3The envelope condition.

Following Gu et al. (2024), it is more convenient to work with W(a,n,z,g):=aV(a,n,z,g)W(a,n,z,g) := \partial_a V(a,n,z,g), which directly gives the consumption policy via c=W1/γc^* = W^{-1/\gamma}. The master equation for WW takes the form:

0=(r(z,g)ρ)W+LxWindividual+LzWaggregate TFP+LgWdistribution,0 = (r(z,g) - \rho)\,W + \underbrace{\mathcal{L}_x W}_{\text{individual}} + \underbrace{\mathcal{L}_z W}_{\text{aggregate TFP}} + \underbrace{\mathcal{L}_g W}_{\text{distribution}},

where LxW\mathcal{L}_x W captures individual state dynamics (savings, income switching), LzW=zWμz+12(σz)2zzW\mathcal{L}_z W = \partial_z W \cdot \mu^z + \frac{1}{2}(\sigma^z)^2\partial_{zz}W captures TFP dynamics, and LgW=n(δW/δgn)μngdy\mathcal{L}_g W = \sum_n \int (\delta W/\delta g_n)\cdot\mu^g_n\,dy captures distribution dynamics.

8.8EMINNs: Solving the Master Equation with Deep Learning

Economic Model Informed Neural Networks (EMINNs), introduced by Gu et al. (2024), solve the master equation by (i) approximating the infinite-dimensional distribution gg by a finite-dimensional object φ^\hat{\varphi}, and (ii) parameterizing WW by a neural network trained to minimize the master equation residual. A teaching-scale companion notebook for EMINNs is forthcoming; in the present edition, the master-equation discussion is text-only and the Aiyagari notebook (lecture_13_08_Aiyagari_Continuous_Time_FD_and_PINN_PyTorch.ipynb) is the closest computational reference.

8.8.1Three Approximation Approaches for the Distribution

The infinite-dimensional distribution gg must be replaced by a finite-dimensional approximation φ^Rd\hat{\varphi} \in \R^d so that V(a,n,z,g)V^(a,n,z,φ^)V(a,n,z,g) \approx \hat{V}(a,n,z,\hat{\varphi}). Table Table 8.3 summarizes the three approaches used in Gu et al. (2024).

Table 8.3:Finite-dimensional representations of the cross-sectional distribution in EMINNs. Here δ\delta_{\bullet} denotes a Dirac measure centered at \bullet, not the depreciation rate of Chapters Chapter 2--Chapter 6.

Finite populationDiscrete stateProjection
φ^t\hat{\varphi}_t{(ati,nti)}i=1N\{(a_t^i, n_t^i)\}_{i=1}^NMasses on grid {a1,,aI}\{a_1,\ldots,a_I\}Basis coefficients
g^t\hat{g}_t1Niδφ^ti\frac{1}{N}\sum_i \delta_{\hat{\varphi}_t^i}i,jφ^ijδ(ai,nj)\sum_{i,j} \hat{\varphi}_{ij}\,\delta_{(a_i,n_j)}b0+iφ^ibi(a,n)b_0 + \sum_i \hat{\varphi}_i b_i(a,n)
Dimension40\sim 40200\sim 2005\sim 5

8.8.1.1Finite population (N40N \approx 40).

Replace the continuum by NN agents with states φ^t={(at1,nt1),,(atN,ntN)}\hat{\varphi}_t = \{(a_t^1, n_t^1),\ldots,(a_t^N,n_t^N)\}. Aggregate capital is Kt=N1iatiK_t = N^{-1}\sum_i a_t^i. Sampling individual states and distribution states separately during training keeps NN manageable; the law of large numbers provides accurate aggregate capital even with 40 agents.

8.8.1.2Discrete state (\sim200 grid points).

Discretize wealth on a grid {a1,,aI}\{a_1,\ldots,a_I\} and represent the distribution as masses φ^i,j\hat{\varphi}_{i,j} at each (ai,nj)(a_i, n_j). The KFE becomes a finite-difference mass evolution, and the functional derivative becomes a partial derivative φ^m,jW^\partial_{\hat{\varphi}_{m,j}}\hat{W}.

8.8.1.3Projection (\sim5 components).

Project gg onto eigenfunctions of the steady-state KFE operator LˉKF\bar{\mathcal{L}}^{KF}. These are the most persistent density components, carrying the most price-relevant information. Only \sim5 basis functions suffice, yielding the lowest-dimensional representation, but the setup requires computing eigenfunctions and choosing appropriate test functions for the KFE evolution.

8.8.2The EMINN Algorithm

A neural network W^Θ(ω)\hat{W}_\Theta(\omega) with ω=(a,n,z,φ^)\omega = (a, n, z, \hat{\varphi}) parameterizes the marginal value of wealth. The output uses a softplus activation to ensure W^>0\hat{W} > 0, and consumption follows directly from the envelope condition: c=W^1/γc^* = \hat{W}^{-1/\gamma}. Algorithm Algorithm 8.1 gives the resulting residual-minimization loop.

This is precisely a PINN applied to the master equation: the “physics” is the economic equilibrium structure, and all derivatives, including those with respect to the distribution parameters φ^\hat{\varphi}, are computed by automatic differentiation.

The master equation residual decomposes as:

0=(r(z,φ^)ρ)W^+L^xW^+L^zW^+L^gW^,0 = (r(z,\hat{\varphi}) - \rho)\,\hat{W} + \hat{\mathcal{L}}_x\hat{W} + \hat{\mathcal{L}}_z\hat{W} + \hat{\mathcal{L}}_g\hat{W},

where L^xW^=s()aW^+λ(n)(W^(n^)W^(n))\hat{\mathcal{L}}_x\hat{W} = s(\cdot)\partial_a\hat{W} + \lambda(n)(\hat{W}(\hat{n}) - \hat{W}(n)) captures savings and income switching, L^zW^=zW^μz+12(σz)2zzW^\hat{\mathcal{L}}_z\hat{W} = \partial_z\hat{W}\cdot\mu^z + \frac{1}{2}(\sigma^z)^2\partial_{zz}\hat{W} captures the OU aggregate shock, and L^gW^=n(W^/φ^n)μφ^,n\hat{\mathcal{L}}_g\hat{W} = \sum_n (\partial\hat{W}/\partial\hat{\varphi}_n)\cdot\mu_{\hat{\varphi},n} captures distribution evolution.

8.8.2.1Computing the drift coefficients μφ^,n\mu_{\hat{\varphi},n}.

The coefficients μφ^,n\mu_{\hat{\varphi},n} describing how the finite-dimensional approximation φ^\hat{\varphi} of the cross-sectional density evolves in time are not given for free. Recovering them is a genuine algorithmic step, and it is the place where the three approximation choices in Section Section 8.8.1 differ most sharply:

Concretely, between the forward pass and the residual evaluation in Algorithm Algorithm 8.1, an additional sub-step computes μφ^,n\mu_{\hat{\varphi},n} for the current φ^\hat{\varphi}; the chain rule through φ^\hat{\varphi} then propagates these coefficients into L^gW^\hat{\mathcal{L}}_g\hat{W}.

8.8.3Shape Constraints and Training Stability

A key practical challenge in training EMINNs is that neural networks may converge to “cheat solutions” (constant, non-increasing, or non-concave value functions that produce small residuals but are economically meaningless). Shape penalties are added to the loss to enforce economic structure:

8.8.4Results and Method Comparison

For the Aiyagari model (no aggregate shocks), Gu et al. (2024) report master-equation residuals of order 10-5 and mean squared errors against finite-difference benchmarks of order 10-5, with close agreement in consumption policies, marginal value functions, and stationary distributions across the finite-population and discrete-state approaches.

For the Krusell--Smith model (with aggregate shocks), their reported results show master-equation training losses of order 10-5 across all three approximation approaches and similar time paths for aggregate variables (capital, interest rate, wage). In that experiment, the projection approach achieves the lowest reported loss (8.5×1068.5 \times 10^{-6}) with only 5 distribution parameters, while the finite-population approach (3.0×1053.0 \times 10^{-5}) offers the simplest implementation.

Table Table 8.4 gives the practical method comparison for this chapter.

Table 8.4:Finite differences, PINNs, and EMINNs for the continuous-time heterogeneous-agent problems covered in this chapter. The entries are practical guidance, not universal impossibility results: finite differences remain the benchmark in low dimension, while EMINNs target the global master-equation setting with the distribution as a state.

Finite differencesPINNEMINN
Stationary equilibriumBenchmark methodWorks, validate carefullyWorks, but overkill
Aggregate shocksLocal/low-dimensional onlyCoupled system, not full master equationDesigned for global master equation
Grid requiredYesNo state gridNo state grid
High-dimensional scalingLimited by gridsBetter, optimization-limitedBetter, distribution-state approximation needed
Handles gg as stateNot in standard stationary FDNoYes, through φ^\hat{\varphi}
Convergence theoryStrong for low-dimensional monotone schemesLimitedLimited
Low-dimensional accuracyOften 106\sim 10^{-6}Problem-dependent; validateReported 105\sim 10^{-5}

For stationary, low-dimensional problems, finite differences remain fast and reliable and should be used as the benchmark. For models with aggregate shocks and high-dimensional state spaces, EMINNs are, among the methods surveyed here, one of the few approaches demonstrated on global master-equation solutions for this class of benchmarks. PINNs serve as a useful intermediate step: they share the same code philosophy as EMINNs (automatic differentiation of PDE residuals) but apply to the coupled HJB--KFE system rather than the master equation.

8.9Further Reading

8.10Exercises

Worked solutions and guidance for these exercises appear in Appendix Appendix F.

Footnotes
References
  1. Achdou, Y., Han, J., Lasry, J.-M., Lions, P.-L., & Moll, B. (2022). Income and wealth distribution in macroeconomics: A continuous-time approach. The Review of Economic Studies, 89(1), 45–86.
  2. Gu, Z., Lauriere, M., Merkel, S., & Payne, J. (2024). Global Solutions to Master Equations for Continuous Time Heterogeneous Agent Macroeconomic Models. https://arxiv.org/abs/2406.13726
  3. Lasry, J.-M., & Lions, P.-L. (2007). Mean Field Games. Japanese Journal of Mathematics, 2(1), 229–260.
  4. Carmona, R., & Delarue, F. (2018). Probabilistic Theory of Mean Field Games with Applications I–II (Vols. 83–84). Springer.
  5. Cardaliaguet, P., Delarue, F., Lasry, J.-M., & Lions, P.-L. (2019). The Master Equation and the Convergence Problem in Mean Field Games. Princeton University Press.
  6. Bewley, T. (1986). Stationary monetary equilibrium with a continuum of independently fluctuating consumers. In W. Hildenbrand & A. Mas-Colell (Eds.), Contributions to Mathematical Economics in Honor of Gérard Debreu (pp. 79–102). North-Holland.
  7. Huggett, M. (1993). The Risk-Free Rate in Heterogeneous-Agent Incomplete-Insurance Economies. Journal of Economic Dynamics and Control, 17(5–6), 953–969. 10.1016/0165-1889(93)90024-M
  8. Aiyagari, S. R. (1994). Uninsured Idiosyncratic Risk and Aggregate Saving. The Quarterly Journal of Economics, 109(3), 659–684.
  9. Krusell, P., & Smith, A. A., Jr. (1998). Income and wealth heterogeneity in the macroeconomy. Journal of Political Economy, 106(5), 867–896.
  10. Shreve, S. E. (2004). Stochastic Calculus for Finance II: Continuous-Time Models. Springer.
  11. Kaplan, G., Moll, B., & Violante, G. L. (2018). Monetary Policy According to HANK. American Economic Review, 108(3), 697–743.