diff --git a/lectures/ak2.md b/lectures/ak2.md index 67726502..de0cf78d 100644 --- a/lectures/ak2.md +++ b/lectures/ak2.md @@ -4,7 +4,7 @@ jupytext: extension: .md format_name: myst format_version: 0.13 - jupytext_version: 1.14.1 + jupytext_version: 1.16.1 kernelspec: display_name: Python 3 (ipykernel) language: python @@ -15,8 +15,9 @@ kernelspec: In addition to what’s in Anaconda, this lecture will need the following libraries: -```{code-cell} ipython3 +```{code-cell} :tags: [hide-output] + !pip install --upgrade quantecon ``` @@ -29,6 +30,7 @@ This lecture presents a life-cycle model consisting of overlapping generations We'll present the version that was analyzed in chapter 2 of Auerbach and Kotlikoff (1987) {cite}`auerbach1987dynamic`. + Auerbach and Kotlikoff (1987) used their two period model as a warm-up for their analysis of overlapping generation models of long-lived people that is the main topic of their book. Their model of two-period lived overlapping generations is a useful starting point because @@ -214,10 +216,10 @@ We take output at time $t$ as *numeraire*, so the price of output at time $t$ is The firm's profits at time $t$ are $$ -K_t^\alpha L_t^{1-\alpha} - r_t K_t - W_t L_t . +\pi_t = K_t^\alpha L_t^{1-\alpha} - r_t K_t - W_t L_t . $$ -To maximize profits a firm equates marginal products to rental rates: +To maximize profits a firm equates marginal products to rental rates, which can be done by taking the first-order derivatives of the profit function $\pi_t$: $$ \begin{aligned} @@ -289,7 +291,7 @@ $$ C_{yt} + \frac{C_{ot+1}}{1 + r_{t+1}(1 - \tau_{t+1})} = W_t (1 - \tau_t) - \delta_{yt} - \frac{\delta_{ot}}{1 + r_{t+1}(1 - \tau_{t+1})} $$ (eq:onebudgetc) -To solve the young person's choice problem, form a Lagrangian +To solve the young person's choice problem, form a [Lagrangian](https://en.wikipedia.org/wiki/Lagrange_multiplier) $$ \begin{aligned} @@ -405,17 +407,15 @@ $$ ### Implementation -```{code-cell} ipython3 +```{code-cell} import numpy as np import matplotlib.pyplot as plt -from numba import njit from quantecon.optimize import brent_max ``` - For parameters $\alpha = 0.3$ and $\beta = 0.5$, let's compute $\hat{K}$: -```{code-cell} ipython3 +```{code-cell} # parameters α = 0.3 β = 0.5 @@ -428,27 +428,28 @@ D_hat = 0. K_hat = ((1 - τ_hat) * (1 - α) * (1 - β)) ** (1 / (1 - α)) K_hat ``` + Knowing $\hat K$, we can calculate other equilibrium objects. Let's first define some Python helper functions. -```{code-cell} ipython3 -@njit +```{code-cell} + def K_to_Y(K, α): return K ** α -@njit + def K_to_r(K, α): return α * K ** (α - 1) -@njit + def K_to_W(K, α): return (1 - α) * K ** α -@njit + def K_to_C(K, D, τ, r, α, β): # optimal consumption for the old when δ=0 @@ -464,35 +465,34 @@ def K_to_C(K, D, τ, r, α, β): We can use these helper functions to obtain steady state values $\hat{Y}$, $\hat{r}$, and $\hat{W}$ associated with steady state values $\hat{K}$ and $\hat{r}$. -```{code-cell} ipython3 +```{code-cell} Y_hat, r_hat, W_hat = K_to_Y(K_hat, α), K_to_r(K_hat, α), K_to_W(K_hat, α) Y_hat, r_hat, W_hat ``` Since steady state government debt $\hat{D}$ is $0$, all taxes are used to pay for government expenditures -```{code-cell} ipython3 +```{code-cell} G_hat = τ_hat * Y_hat G_hat ``` We use the optimal consumption plans to find steady state consumptions for young and old -```{code-cell} ipython3 +```{code-cell} Cy_hat, Co_hat = K_to_C(K_hat, D_hat, τ_hat, r_hat, α, β) Cy_hat, Co_hat ``` -Let's store the steady state quantities and prices using an array called `init_ss` +Let's store the steady state quantities and prices using an array called `init_ss` -```{code-cell} ipython3 +```{code-cell} init_ss = np.array([K_hat, Y_hat, Cy_hat, Co_hat, # quantities W_hat, r_hat, # prices τ_hat, D_hat, G_hat # policies ]) ``` - ### Transitions