From 74b433efc16a89128f159a1efbc46c972ce9ebe1 Mon Sep 17 00:00:00 2001 From: akshay_shanker Date: Wed, 28 May 2025 21:07:10 +1000 Subject: [PATCH] SSJ explanation minor edits and some prose. --- .../SSJ_explanation.ipynb | 74 +++++++++++-------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/examples/ConsNewKeynesianModel/SSJ_explanation.ipynb b/examples/ConsNewKeynesianModel/SSJ_explanation.ipynb index 39503076e..0676d8687 100644 --- a/examples/ConsNewKeynesianModel/SSJ_explanation.ipynb +++ b/examples/ConsNewKeynesianModel/SSJ_explanation.ipynb @@ -5,7 +5,7 @@ "id": "5d86d99a", "metadata": {}, "source": [ - "# Sequence Space Jacobian method to Solve HANK models" + "# The Sequence Space Jacobian (SSJ) method" ] }, { @@ -13,13 +13,27 @@ "id": "d54e4a66", "metadata": {}, "source": [ - "- The sequence space jacobian method (SSJ) is a computational method to solve general equilibrium models, both with and without rich micro heterogeneity\n", - "\n", - "- Method linearizes the model to first order to solve for solutions to small MIT shocks.\n", - "\n", - "- The algorithm assumes that agents have perfect foresight on macro aggregates (i.e. model is deterministic with respect to aggregate states).\n", - "\n", - "- Method allows for the fast computation of Jacobian matrices that summarize the aggregate behavior of agents with rich micro heterogeneity (heterogenous households, firms, etc.)" + "- [Krusell and Smith (1997)](https://www.journals.uchicago.edu/doi/abs/10.1086/250034) solved their HA macro model with a \"state space\" method\n", + " - They approximate the model solution for every conceivable combination of states\n", + " - This is very expensive computationally\n", + "\n", + "- The [sequence space Jacobian method (SSJ)](https://www.econometricsociety.org/publications/econometrica/2021/09/01/using-sequence-space-jacobian-solve-and-estimate-heterogeneous) (Auclert et al., 2021) is an alternative\n", + " - It computes a solution to the model for an expected path of shocks\n", + " - This allows computation of the solution for only the interesting shocks\n", + "\n", + "- The SSJ method solves for solutions to 'MIT shocks'\n", + " - The key requirement is that the MIT shocks be small, _relative_ to the distribution of microeconomic state variables\n", + " - This permits -- in fact, requires -- rich micro heterogeneity\n", + " - SSJ is usable when there is an aggregate equilibrium and micro heterogeneity\n", + " - So long as the \"aggregate shocks\" are _relatively_ small\n", + " - So it can be used to study industry or market equilibrium\n", + "\n", + "- The algorithm assumes that agents have perfect foresight wrt aggregates\n", + " - The model is deterministic wrt the evolution of aggregate \"shocks\"\n", + "\n", + "- As a result, easily calculable Jacobian matrices are a \"sufficient statistic\"\n", + " - They provide information sufficient to compute the macro dynamics\n", + " - Even when the microfoundations have rich complexity and realism\n" ] }, { @@ -29,9 +43,10 @@ "source": [ "## Advantages of SSJ\n", "\n", - "Can solve general equilibrium models with rich microeconomic heterogeneity quickly. (Basic HANK models can take 3 seconds, previous methods take at least 15 minutes)\n", + "- Can solve equilibrium models with rich microeconomic heterogeneity\n", + " - Basic HANK models can take 3 seconds, previous methods take at least 15 minutes\n", "\n", - "Can add additional exogenous shocks at virtually no cost." + "- Can add additional exogenous aggregate shocks at virtually no cost." ] }, { @@ -39,7 +54,9 @@ "id": "095bae35", "metadata": {}, "source": [ - "## Krusell Smith Model in Sequence Space" + "## Krusell Smith Model in Sequence Space\n", + "\n", + "Here we solve a slightly simplified version of the Krusell-Smith model to clarify the exposition. In particular, we assume each household inelastically supplies $\\ell$ units of labor.\n" ] }, { @@ -49,7 +66,7 @@ "source": [ "### Households\n", "\n", - "Assume a continuum of atomistic households on the unit interval $[0,1]$ indexed by i. \n", + "Assume a continuum of atomistic households on the unit interval $[0,1]$ indexed by $i$. \n", "\n", "Assume households have perfect foresight over the real interest rate $r_{t}$ and the real wage $w_{t}$.\n", "\n" @@ -74,18 +91,12 @@ "\n", "$$k_{it} \\geq 0,$$\n", "\n", - "where \n", - "\n", - "$m_{it}$ is cash on hand,\n", - "\n", - "$k_{it}$ is capital holdings,\n", - "\n", - "$y_{it}$ is labor income.\n", + "where $m_{it}$ is market resources (`cash on hand`), $k_{it}$ is capital holdings and $y_{it}$ is labor income.\n", "\n", "\n", "#### Labor Income\n", "\n", - "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$. \n", + "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$:\n", "\n", "$$y_{t} = \\theta_{it} w_{t} \\ell,$$\n", "\n", @@ -147,7 +158,7 @@ "id": "12cc8957", "metadata": {}, "source": [ - "# The model as a system of difference equations in sequence space" + "# Model as defined by diff eqns in sequence space" ] }, { @@ -155,7 +166,8 @@ "id": "01ee68b8", "metadata": {}, "source": [ - "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:\n", + "\n", + "The sequence-space equilibrium 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:\n", "\n", "$$ H_{t}(\\mathbf{U},\\mathbf{Z}) = \\begin{pmatrix} \n", " \\mathcal{K}_{t}(\\{r_{s} ,w_{s} \\}_{s=t}^{s=T}) - K_{t} \\\\ \\\\\n", @@ -233,9 +245,9 @@ "id": "1488f183", "metadata": {}, "source": [ - "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.\n", + "These Jacobian matrices are the most computationally complex object to compute in the model. On a 2024 laptop used to produce the results here, such methods can take up to 20 minutes for each matrix.\n", "\n", - "The sequence space Jacobian methodology proposes a 'fake news' algorithm to solve these matrices in under 3 seconds!" + "But the sequence space Jacobian methodology uses a 'fake news' algorithm to solve these matrices in under 3 seconds!" ] }, { @@ -276,7 +288,7 @@ "id": "c66c3791", "metadata": {}, "source": [ - "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:\n", + "Here, because labor is exogenously supplied, aggregate capital $K_t$ is a sufficient statistic for factor prices $r_t$ and $w_t$. The system above can thus be reduced to simply:\n", "\n", "$$ H_{t}(\\mathbf{U},\\mathbf{Z}) \\equiv \\begin{pmatrix} \n", " \\mathcal{K}_{t}\\left(\\{\\alpha Z_{t} K_{t}^{\\alpha - 1} \\bar{L}^{1-\\alpha} ,(1-\\alpha) Z_{s} K_{s}^{\\alpha} \\bar{L}^{-\\alpha} \\}_{s=0}^{s=T}\\right) - K_{t} \\\\\n", @@ -318,12 +330,14 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "3ee1c897-4a63-4437-a596-0c8af34ada66", + "cell_type": "markdown", + "id": "be891e16-d276-49c7-8374-2478de587664", "metadata": {}, - "outputs": [], - "source": [] + "source": [ + "## Solving Using the HANK-SSJ Link\n", + "\n", + "A companion notebook, `KS-HARK-presentation` presents the solution to the model described above using the HARK toolkit in combination with the SSJ toolkit." + ] } ], "metadata": {