diff --git a/examples/ConsWealthUtilityModel/WealthUtilityConsumerType.ipynb b/examples/ConsWealthUtilityModel/WealthUtilityConsumerType.ipynb index 59df33cff..953076fac 100644 --- a/examples/ConsWealthUtilityModel/WealthUtilityConsumerType.ipynb +++ b/examples/ConsWealthUtilityModel/WealthUtilityConsumerType.ipynb @@ -9,7 +9,7 @@ "\n", "The typical consumption-saving model assumes that agents derive a flow of utility from consumption each period, with additively separable utility across time. In `HARK.ConsumptionSaving.ConsWealthUtility` module, we change this assumption to allow wealth (end-of-period assets) to enter the agent's utility function directly.\n", "\n", - "This notebook concerns agents whose direct preferences for wealth are represented *multiplicatively* with consumption under a Cobb-Douglas aggregator. For *additive* direct preferences for wealth, see [the notebook for `CapitalistSpiritConsumerType`](./CapitalistSpiritConsumerType.ipynb) in the same module." + "This notebook concerns agents whose direct preferences for wealth are represented *multiplicatively* with consumption under a Cobb-Douglas aggregator. For *additive* direct preferences for wealth, see [the notebook](./CapitalistSpiritConsumerType.ipynb) for `CapitalistSpiritConsumerType` in the same module." ] }, { @@ -37,7 +37,7 @@ }, { "cell_type": "markdown", - "id": "7fe39fa7", + "id": "6dea0dcf-dbfc-4743-af71-845221884b71", "metadata": {}, "source": [ "$$\n", @@ -64,14 +64,8 @@ "\n", "A `WealthUtilityConsumerType`'s problem can be expressed as:\n", "\n", - "$$\n", - "\\begin{equation*}\n", - " v_t(m_t) = \\max_{c_t}u(x_t) + \\DiscFac \\LivPrb_{t} \\mathbb{E}_{t} \\left[ (\\PermGroFac_{t+1} \\psi_{t+1})^{1-\\CRRA} v_{t+1}(m_{t+1}) \\right] ~~\\text{s.t.}\n", - "\\end{equation*}\n", - "$$\n", - "\n", - "$$\n", "\\begin{eqnarray*}\n", + " v_t(m_t) &=& \\max_{c_t}u(x_t) + \\DiscFac \\LivPrb_{t} \\mathbb{E}_{t} \\left[ (\\PermGroFac_{t+1} \\psi_{t+1})^{1-\\CRRA} v_{t+1}(m_{t+1}) \\right] ~~\\text{s.t.} \\\\\n", " u(x) &=& \\frac{x^{1-\\CRRA}}{1-\\CRRA}, \\\\\n", " x_t &=& (a_t + \\WealthShift)^\\WealthShare c_t^{1-\\WealthShare}, \\\\\n", " a_t &=& m_t - c_t, \\\\\n", @@ -79,8 +73,7 @@ " m_{t+1} &=& a_t \\Rfree_{t+1}/(\\PermGroFac_{t+1} \\psi_{t+1}) + \\theta_{t+1}, \\\\\n", " (\\psi_{t+1},\\theta_{t+1}) &\\sim& F_{t+1}, \\\\\n", " \\mathbb{E}[\\psi] &=& 1. \\\\\n", - "\\end{eqnarray*}\n", - "$$\n" + "\\end{eqnarray*}\n" ] }, { @@ -106,12 +99,10 @@ "\n", "In the standard consumption-saving model with CRRA utility over consumption only, the first order condition w.r.t consumption is trivial to invert; this is not the case when consumption and wealth are multiplicatively combined into a single term in the CRRA function. To start, we substitute the Cobb-Douglas aggregator into the CRRA utility function:\n", "\n", - "$$\n", "\\begin{eqnarray*}\n", "u(\\cNrm, \\aNrm) &=& \\frac{\\left(\\cNrm^{1-\\WealthShare}(\\aNrm+\\WealthShift)^{\\WealthShare}\\right)^{1-\\CRRA}}{1-\\CRRA} \\\\\n", "&=& \\frac{\\left(\\cNrm^{1-\\WealthShare}(\\mNrm - \\cNrm + \\WealthShift)^{\\WealthShare}\\right)^{1-\\CRRA}}{1-\\CRRA}.\n", - "\\end{eqnarray*}\n", - "$$\n" + "\\end{eqnarray*}\n" ] }, { @@ -121,14 +112,12 @@ "source": [ "Fixing market resources $\\mNrm$ at some value of interest, the marginal return to utility from consumption is:\n", "\n", - "$$\n", "\\begin{align*}\n", "\\frac{\\text{d}}{\\text{d} \\cNrm} u(\\cNrm, \\mNrm-\\cNrm) &= \\left[ (1-\\WealthShare) \\cNrm^{-\\WealthShare} (\\mNrm - \\cNrm + \\WealthShift)^\\WealthShare - \\WealthShare \\cNrm^{1-\\WealthShare}(\\mNrm - \\cNrm + \\WealthShift)^{\\WealthShare-1} \\right] \\cdot \\left( (\\mNrm - \\cNrm + \\WealthShift)^\\WealthShare \\cNrm^{1-\\WealthShare} \\right)^{-\\CRRA} \\\\\n", " &= \\left[ (1-\\WealthShare) \\left(\\frac{\\cNrm}{\\mNrm-\\cNrm + \\WealthShift}\\right)^{-\\WealthShare} - \\WealthShare \\left(\\frac{\\cNrm}{\\mNrm - \\cNrm + \\WealthShift} \\right)^{1-\\WealthShare} \\right] \\cdot \\left( (\\mNrm - \\cNrm + \\WealthShift)^\\WealthShare \\cNrm^{1-\\WealthShare} \\right)^{-\\CRRA} \\\\\n", " &= \\left[ (1-\\WealthShare) \\left(\\frac{\\cNrm}{\\aNrm + \\WealthShift}\\right)^{-\\WealthShare} - \\WealthShare \\left(\\frac{\\cNrm}{\\aNrm + \\WealthShift} \\right)^{1-\\WealthShare} \\right] \\cdot \\left( (\\aNrm + \\WealthShift) (\\aNrm + \\WealthShift)^{\\WealthShare-1} \\cNrm^{1-\\WealthShare} \\right)^{-\\CRRA} \\\\\n", " &= \\left[ (1-\\WealthShare) \\chi^{-\\WealthShare} - \\WealthShare \\chi^{1-\\WealthShare} \\right] \\cdot \\left( (\\aNrm + \\WealthShift) \\chi^{1-\\WealthShare} \\right)^{-\\CRRA}, ~~~~ \\chi \\equiv \\frac{\\cNrm}{\\aNrm + \\WealthShift}.\n", - "\\end{align*}\n", - "$$\n" + "\\end{align*}\n" ] }, { @@ -154,25 +143,19 @@ "source": [ "Consider the first order condition for optimality by taking the derivative of the maximand with respect to $\\cNrm$ and equating it to zero:\n", "\n", - "$$\n", "\\begin{equation}\n", "\\frac{\\text{d}}{\\text{d} \\cNrm} u(\\cNrm_t, \\mNrm_t-\\cNrm_t) - \\mathfrak{v}'_t(\\mNrm_t - \\cNrm_t) = 0.\n", "\\end{equation}\n", - "$$\n", "\n", "We can substitute the final form of the marginal return to consumption, move the second term to the right-hand side, and then rearrange slightly to get:\n", "\n", - "$$\n", "\\begin{equation*}\n", "\\left[ (1-\\WealthShare) \\chi_t^{-\\WealthShare} - \\WealthShare \\chi_t^{1-\\WealthShare} \\right] \\cdot \\left( (\\aNrm_t + \\WealthShift) \\chi_t^{1-\\WealthShare} \\right)^{-\\CRRA} = \\mathfrak{v}'_t(\\aNrm_t) \\Longrightarrow\n", "\\end{equation*}\n", - "$$\n", "\n", - "$$\n", "\\begin{equation*}\n", "\\left[ (1-\\WealthShare) \\chi_t^{-\\WealthShare} - \\WealthShare \\chi_t^{1-\\WealthShare} \\right]^{-1/\\CRRA} \\cdot \\chi_t^{1-\\WealthShare} = \\underbrace{\\mathfrak{v}'_t(\\aNrm_t)^{-1/\\CRRA} / (\\aNrm_t + \\WealthShift)}_{\\equiv ~ \\omega_t}.\n", - "\\end{equation*}\n", - "$$\n" + "\\end{equation*}\n" ] }, { @@ -192,19 +175,15 @@ "source": [ "First, note that the expression in square brackets is not positive for all values of $\\chi > 0$, with the bounding condition defined by:\n", "\n", - "$$\n", "\\begin{equation*}\n", "(1-\\WealthShare) \\chi^{-\\WealthShare} - \\WealthShare \\chi^{1-\\WealthShare} > 0 \\Longrightarrow (1-\\WealthShare) \\chi^{-\\WealthShare} > \\WealthShare \\chi^{1-\\WealthShare} \\Longrightarrow \\frac{1-\\WealthShare}{\\WealthShare} >\\chi.\n", "\\end{equation*}\n", - "$$\n", "\n", "The expression in square brackets is raised to a negative power, hence we need only to consider values of $\\chi \\in (0, (1 -\\WealthShare)/\\WealthShare)$. These $\\chi$ values represent the *range* of the function that maps from $\\omega$ to $\\chi$, and we want our constructed approximation to cover as much of that range as possible. To do so, we will use the logit transformation to map from an auxiliary variable $z \\in \\R$ to $\\chi \\in (0, (1 -\\WealthShare)/\\WealthShare)$:\n", "\n", - "$$\n", "\\begin{equation*}\n", "\\chi = \\frac{\\exp(z)}{1 + \\exp(z)} \\cdot \\frac{1-\\WealthShare}{\\WealthShare}.\n", - "\\end{equation*}\n", - "$$\n" + "\\end{equation*}\n" ] }, { @@ -335,7 +314,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Solving a wealth-in-utility consumption-saving problem took 0.1080 seconds.\n" + "Solving a wealth-in-utility consumption-saving problem took 0.1052 seconds.\n" ] } ], @@ -407,7 +386,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Solving a standard consumption-saving problem took 0.1040 seconds.\n" + "Solving a standard consumption-saving problem took 0.1050 seconds.\n" ] } ],