Interactive online version: . Download notebook.
Sequence Space Jacobian method to Solve HANK models#
The sequence space jacobian method (SSJ) is a computational method to solve general equilibrium models, both with and without rich micro heterogeneity
Method linearizes the model to first order to solve for solutions to small MIT shocks.
The algorithm assumes that agents have perfect foresight on macro aggregates (i.e. model is deterministic with respect to aggregate states).
Method allows for the fast computation of Jacobian matrices that summarize the aggregate behavior of agents with rich micro heterogeneity (heterogenous households, firms, etc.)
Advantages of SSJ#
Can solve general equilibrium models with rich microeconomic heterogeneity quickly. (Basic HANK models can take 3 seconds, previous methods take at least 15 minutes)
Can add additional exogenous shocks at virtually no cost.
Krusell Smith Model in Sequence Space#
Households#
Assume a continuum of atomistic households on the unit interval \([0,1]\) indexed by i.
Assume households have perfect foresight over the real interest rate \(r_{t}\) and the real wage \(w_{t}\).
Household’s Problem#
Households seek to maximize their expected discounted sum of lifetime utility of consumption. Variables that are idiosyncratic to a household have an \(i\) subscript, while aggregate variables do not.
where
\(m_{it}\) is cash on hand,
\(k_{it}\) is capital holdings,
\(y_{it}\) is labor income.
Labor Income#
Labor income is the product of an idiosyncratic transitory shock \(\theta\), the wage rate \(w\) (determined in aggregate), and the exogenously fixed individual labor supply \(\ell\).
Firms and Production#
Output is produced by firms via a Cobb-Douglas production function over aggregate capital \(K_t\) and labor \(L_t\), scaled by total factor productivity \(Z_t\):
Determination of Wage and Interest Rates#
Assume perfectly competitive markets, so that the factor prices are given by their marginal product:
Dynamics of Productivity#
TFP \(Z_t\) follows an AR(1) process in logs, with correlation factor \(\rho_Z\) and standard deviation of shocks \(\sigma_Z\).
Market Clearing#
Aggregate capital and labor are found by aggregating idiosyncratic values over the population. For labor, this is trivial, as each household exogenously supplies \(\ell\) units of labor. To denote the switch to aggregate labor, apply a new label:
Each household’s choice of capital holdings \(k_{it}\) depends on the entire future sequence of factor prices they will face. Denote that sequence as \(\left\{r_{s},w_{s}\right\}_{s=0}^{T}\), and the savings function in period \(t\) as \(\mathsf{k}_t(m_{it}, \cdot)\), which depends on current market resources and future prices. Then define aggregate capital as:
Notice that aggregate capital \(K_t\) depends on the entire distribution of idiosyncratic market resources \(m_{it}\).
The model as a system of difference equations in sequence space#
The equilibrium of this model can be expressed as a root of a system of difference equations on the sequence of current and future prices and productivity shocks. For notational convenience, the sequence of aggregate outcomes will be represented by \(\textbf{U}\), and the sequence of productivity shocks by \(\textbf{Z}\). For period \(t\), the equilibrium conditions are:
where
\(\mathbf{U} = \left\{K_{t}, r_{t}, w_{t} \right\}_{t=0}^{s=T},\)
\(\mathbf{Z} = \left\{Z_{t}\right\}_{t=0}^{t=T}.\)
The equilibrium conditions for a single period can be stacked across all periods \(t=0,\cdots,T\), yielding the overall system:
Solve the model by linearizing around the steady state#
We are interested in how aggregate outcomes will change in response to exogenous shocks. Denote the endogenous impulse response as \(d\mathbf{U} \equiv \left\{dK_{t} , dr_{t} , dw_{t} \right\}_{t=0}^{t=T}\), and the exogenous shock (a change in future productivity shocks) as \(d\mathbf{Z} = \left\{ dZ_{t}\right\}_{t=0}^{t=T}\).
The characterization of the equilibrium conditions as a root of a system of equations \(\mathbf{H}(\mathbf{U},\mathbf{Z}) = 0\) defined on the sequence space allows us to apply the implicit function theorem to finf the impulse response:
We thus have a characterization of how aggregate outcomes respond to exogenous shocks near the steady state outcomes. In this context, the ``steady state productivity shock sequence’’ \(\mathbf{Z}_{ss}\) is simply \((0,\cdots,0)\), and the steady state outcome sequence is a constant sequence of aggregate capital and factor prices that obtain in the absence of macroeconomic shocks.
Heterogenous Agent Jacobian#
When computing \(-\mathbf{H}_{\mathbf{U}}(\mathbf{U}_{ss},\mathbf{Z}_{ss})^{-1}\) we will need to compute the Jacobian of
More specifically, we will need the Jacobian matrices \(\mathbf{F}_{\mathbf{r}}(\mathbf{r},\mathbf{w})\) and \(\mathbf{F}_{\mathbf{w}}(\mathbf{r},\mathbf{w})\), where
(and likewise for \(\mathbf{F}_{\mathbf{w}}(\mathbf{r},\mathbf{w})\)).
These Jacobian matrices are the most computationally complex object to compute in the model. Direct methods can take up to 20 minutes for each matrix.
The sequence space Jacobian methodology proposes a ‘fake news’ algorithm to solve these matrices in under 3 seconds!
Overall algorithm#
Define model in sequence space
Solve for steady state
where \(\mathbf{U}_{ss} = \left(U_{ss}, .. U_{ss}, .., U_{ss} \right)\)
Linearize around steady state and solve for impulse responses \(d\mathbf{U}\) given exogenous shock \(d\mathbf{Z}\)
When linearizing, find heterogenous agent Jacobians with fake news algorithm
What if the model contains many equations?#
Because labor is exogenously supplied, aggregate capital \(K_t\) is a perfect instrument for factor prices \(r_t\) and \(w_t\). The system above can thus be reduced to simply:
where \(\mathbf{U} = \left(K_{0},K_{1}.K_{2}....,K_{T} \right)\).
When the model contains many equations, we can represent the model as a directed acyclic graph to determine how the model should be reduced.
[1]:
from IPython import display
display.Image("KS_DAG.jpeg")
[1]:
[ ]: