From 01a91548688ff8f557011c1897a0836c40f7af74 Mon Sep 17 00:00:00 2001 From: thomassargent30 Date: Wed, 29 May 2024 17:49:24 +0900 Subject: [PATCH 1/4] Tom's May 29 addition of a new lecture ak2.md --- lectures/_toc.yml | 2 +- lectures/ak2.md | 368 +++++++++++++++++++++++++++++----------------- 2 files changed, 237 insertions(+), 133 deletions(-) diff --git a/lectures/_toc.yml b/lectures/_toc.yml index 2ce9b56f..15170f99 100644 --- a/lectures/_toc.yml +++ b/lectures/_toc.yml @@ -55,7 +55,7 @@ parts: - file: money_inflation_nonlinear - file: laffer_adaptive #- file: french_rev - #- file: ak2 + - file: ak2 - caption: Stochastic Dynamics numbered: true chapters: diff --git a/lectures/ak2.md b/lectures/ak2.md index 6f530a5c..c71959d3 100644 --- a/lectures/ak2.md +++ b/lectures/ak2.md @@ -13,15 +13,20 @@ kernelspec: # Transitions in an Overlapping Generations Model +In addition to what’s in Anaconda, this lecture will need the following libraries: +```{code-cell} ipython3 +!pip install --upgrade quantecon +``` -## Overview +## Introduction -This lecture presents a life-cycle model consisting of overlapping generations of two-period lived people proposed by +This lecture presents a life-cycle model consisting of overlapping generations of two-period lived people proposed by Peter Diamond {cite}`diamond1965national`. -We'll present the version that was analyzed in chapter 2 of {cite}`auerbach1987dynamic`. +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. @@ -30,22 +35,17 @@ Their model of two-period lived overlapping generations is a useful starting poi * it sets forth the structure of interactions between generations of different agents who are alive at a given date * it activates forces and tradeoffs confronting the government and successive generations of people * it is good laboratory for studying connections between government tax and subsidy programs and for policies for issuing and servicing government debt -* it is a good setting for introducing describing the **shooting method** for solving a system of non-linear difference equations with boundary conditions that take the form of initial and terminal conditions -* interesting experiments involving transitions from one steady state to another can be computed by hand +* some interesting experiments involving transitions from one steady state to another can be computed by hand +* it is a good setting for illustrating a **shooting method** for solving a system of non-linear difference equations with initial and terminal condition ```{note} Auerbach and Kotlikoff use computer code to calculate transition paths for their models with long-lived people. ``` -We take the liberty of extending Auerbach and Kotlikoff's chapter 2 model by adding ways to redistribute resources across generations +We take the liberty of extending Auerbach and Kotlikoff's chapter 2 model to study some arrangements for redistributing resources across generations * these take the form of a sequence of age-specific lump sum taxes and transfers -We study how these additional instruments for redistributing resources across generations affect capital accumulation and government debt - - - - - +We study how these arrangements affect capital accumulation and government debt ## Setting @@ -55,25 +55,25 @@ The economy lives forever, but the people inside it do not. At each time $ t \geq 0$ a representative old person and a representative young person are alive. -Thus, at time $t$ a representative old person coexists with a representative young person who will become an old person at time $t+1$. +At time $t$ a representative old person coexists with a representative young person who will become an old person at time $t+1$. We assume that the population size is constant over time. A young person works, saves, and consumes. -An old person dissaves and consumes but does not work, +An old person dissaves and consumes, but does not work, -There is a government that lives forever, i.e., at $t=0, 1, 2, \ldots $. +A government lives forever, i.e., at $t=0, 1, 2, \ldots $. Each period $t \geq 0$, the government taxes, spends, transfers, and borrows. -Initial conditions set from outside the model at time $t=0$ are +Initial conditions set outside the model at time $t=0$ are * $K_0$ -- initial capital stock brought into time $t=0$ by a representative initial old person -* $D_0$ government debt falling due at $t=0$ and owned by a representative old person at time $t=0$ +* $D_0$ -- government debt falling due at $t=0$ and owned by a representative old person at time $t=0$ $K_0$ and $D_0$ are both measured in units of time $0$ goods. @@ -81,7 +81,7 @@ A government **policy** consists of five sequences $\{G_t, D_t, \tau_t, \delta_ * $\tau_t$ -- flat rate tax at time $t$ on wages and earnings from capital and government bonds * $D_t$ -- one-period government bond principal due at time $t$, per capita - * $G_t$ -- government purchases of goods at time $t$ (`thrown into ocean'), per capita + * $G_t$ -- government purchases of goods at time $t$, per capita * $\delta_{yt}$ -- a lump sum tax on each young person at time $t$ * $\delta_{ot}$ -- a lump sum tax on each old person at time $t$ @@ -104,7 +104,7 @@ National income and product accounts consist of a sequence of equalities * $Y_t = C_{yt} + C_{ot} + (K_{t+1} - K_t) + G_t, \quad t \geq 0$ -A **price system** is a pair of sequences $\{W_t, r_t\}_{t=0}^\infty$; constituents of the sequence include rental rates for the factors of production +A **price system** is a pair of sequences $\{W_t, r_t\}_{t=0}^\infty$; constituents of a price sequence include rental rates for the factors of production * $W_t$ -- rental rate for labor at time $t \geq 0$ * $r_t$ -- rental rate for capital at time $t \geq 0$ @@ -116,21 +116,21 @@ There are two factors of production, physical capital $K_t$ and labor $L_t$. Capital does not depreciate. -The initial capital stock $K_0$ is owned by the initial old person, who rents it to the firm at time $0$. +The initial capital stock $K_0$ is owned by the representative initial old person, who rents it to the firm at time $0$. -The economy's net investment rate $I_t$ at time $t$ is +Net investment rate $I_t$ at time $t$ is $$ I_t = K_{t+1} - K_t $$ -The economy's capital stock at time $t$ emerges from cumulating past rates of investment: +The capital stock at time $t$ emerges from cumulating past rates of investment: $$ K_t = K_0 + \sum_{s=0}^{t-1} I_s $$ -There is a Cobb-Douglas technology that converts physical capital $K_t$ and labor services $L_t$ into +A Cobb-Douglas technology converts physical capital $K_t$ and labor services $L_t$ into output $Y_t$ $$ @@ -161,7 +161,7 @@ $$ D_{t+1} = (1 + r_t) D_t + G_t - T_t . $$ (eq:govbudgetsequence) -Here total tax collections net of transfers are given by $T_t$ satisfying +Total tax collections net of transfers equal $T_t$ and satisfy $$ @@ -171,18 +171,18 @@ $$ -## Households' Activities in Factor Markets +## Activities in Factor Markets -**Old people:** At each $t \geq 0$, an old person +**Old people:** At each $t \geq 0$, a representative old person * brings $K_t$ and $D_t$ into the period, * rents capital to a representative firm for $r_{t} K_t$, - * pays taxes $\tau_t (K_t+ D_t)$ on its rental and interest earnings, + * pays taxes $\tau_t r_t (K_t+ D_t)$ on its rental and interest earnings, * pays a lump sum tax $\delta_{ot}$ to the government, * sells $K_t$ to a young person. - **Young people:** At each $t \geq 0$, a young person + **Young people:** At each $t \geq 0$, a representative young person * sells one unit of labor services to a representative firm for $W_t$ in wages, * pays taxes $\tau_t W_t$ on its labor earnings * pays a lump sum tax $\delta_{yt}$ to the goverment, @@ -196,7 +196,7 @@ If a lump-sum tax is negative, it means that the government pays the person a su ## Representative firm's problem -The firm hires labor services from young households at competitive wage rate $W_t$ and hires capital from old households at competitive rental rate +The representative firm hires labor services from young people at competitive wage rate $W_t$ and hires capital from old people at competitive rental rate $r_t$. The rental rate on capital $r_t$ equals the interest rate on government one-period bonds. @@ -204,12 +204,12 @@ The rental rate on capital $r_t$ equals the interest rate on government one-peri Units of the rental rates are: * for $W_t$, output at time $t$ per unit of labor at time $t$ -* for $r_t$, output at time $t$ per unit of capita at time $t$ +* for $r_t$, output at time $t$ per unit of capital at time $t$ We take output at time $t$ as *numeraire*, so the price of output at time $t$ is one. -The firm's profits at time $t$ are thus +The firm's profits at time $t$ are $$ K_t^\alpha L_t^{1-\alpha} - r_t K_t - W_t L_t . @@ -218,16 +218,16 @@ $$ To maximize profits a firm equates marginal products to rental rates: $$ -\begin{aligned} +\begin{align} W_t & = (1-\alpha) K_t^\alpha L_t^{-\alpha} \\ r_t & = \alpha K_t^\alpha L_t^{1-\alpha} -\end{aligned} +\end{align} $$ (eq:firmfonc) -Output can either be consumed by old or young households, sold to young households who use it to augment the capital stock, or sold to the government for uses that do not generate utility for the people in the model (e.g., ``thrown into the ocean''). +Output can be consumed either by old people or young people; or sold to young people who use it to augment the capital stock; or sold to the government for uses that do not generate utility for the people in the model (i.e., ``it is thrown into the ocean''). -The firm thus sells output to old households, young households, and the government. +The firm thus sells output to old people, young people, and the government. @@ -237,16 +237,16 @@ The firm thus sells output to old households, young households, and the governm -## Households' problems +## Individuals' problems -### Initial old household +### Initial old person -At time $t=0$, a representative initial old household is endowed with $(1 + r_0(1 - \tau_0)) A_0$ in initial assets. +At time $t=0$, a representative initial old person is endowed with $(1 + r_0(1 - \tau_0)) A_0$ in initial assets. It must pay a lump sum tax to (if positive) or receive a subsidy from (if negative) $\delta_{ot}$ the government. -An old household's budget constraint is +An old person's budget constraint is @@ -254,17 +254,17 @@ $$ C_{o0} = (1 + r_0 (1 - \tau_0)) A_0 - \delta_{ot} . $$ (eq:hbudgetold) -An initial old household's utility function is $C_{o0}$, so the household's optimal consumption plan +An initial old person's utility function is $C_{o0}$, so the person's optimal consumption plan is provided by equation {eq}`eq:hbudgetold`. -### Young household +### Young person -At each $t \geq 0$, a young household inelastically supplies one unit of labor and in return +At each $t \geq 0$, a young person inelastically supplies one unit of labor and in return receives pre-tax labor earnings of $W_t$ units of output. -A young-household's post-tax-and-transfer earnings are $W_t (1 - \tau_t) - \delta_{yt}$. +A young person's post-tax-and-transfer earnings are $W_t (1 - \tau_t) - \delta_{yt}$. -At each $t \geq 0$, a young household chooses a consumption plan $C_{yt}, C_{ot+1}$ +At each $t \geq 0$, a young person chooses a consumption plan $C_{yt}, C_{ot+1}$ to maximize the Cobb-Douglas utility function $$ @@ -274,10 +274,10 @@ $$ (eq:utilfn) subject to the following budget constraints at times $t$ and $t+1$: $$ -\begin{aligned} +\begin{align} C_{yt} + A_{t+1} & = W_t (1 - \tau_t) - \delta_{yt} \\ C_{ot+1} & = (1+ r_{t+1} (1 - \tau_{t+1}))A_{t+1} - \delta_{ot} -\end{aligned} +\end{align} $$ (eq:twobudgetc) @@ -287,12 +287,12 @@ $$ 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 household's choice problem, form a Lagrangian +To solve the young person's choice problem, form a Lagrangian $$ -\begin{aligned} +\begin{align} {\mathcal L} & = C_{yt}^\beta C_{o,t+1}^{1-\beta} \\ & + \lambda \Bigl[ 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})}\Bigr], -\end{aligned} +\end{align} $$ (eq:lagC) where $\lambda$ is a Lagrange multiplier on the intertemporal budget constraint {eq}`eq:onebudgetc`. @@ -302,10 +302,10 @@ After several lines of algebra, the intertemporal budget constraint {eq}`eq:oneb imply that an optimal consumption plan satisfies $$ -\begin{aligned} +\begin{align} C_{yt} & = \beta \Bigl[ W_t (1 - \tau_t) - \delta_{yt} - \frac{\delta_{ot}}{1 + r_{t+1}(1 - \tau_{t+1})}\Bigr] \\ \frac{C_{0t+1}}{1 + r_{t+1}(1-\tau_{t+1}) } & = (1-\beta) \Bigl[ W_t (1 - \tau_t) - \delta_{yt} - \frac{\delta_{ot}}{1 + r_{t+1}(1 - \tau_{t+1})}\Bigr] -\end{aligned} +\end{align} $$ (eq:optconsplan) The first-order condition for minimizing Lagrangian {eq}`eq:lagC` with respect to the Lagrange multipler $\lambda$ recovers the budget constraint {eq}`eq:onebudgetc`, @@ -321,9 +321,9 @@ $$ (eq:optsavingsplan) **Definition:** An equilibrium is an allocation, a government policy, and a price system with the properties that * given the price system and the government policy, the allocation solves - * represenative firms' problems for $t \geq 0$ - * households problems for $t \geq 0$ -* given the price system and the allocation, the government budget constraint is satisfies for all $t \geq 0$. + * representative firms' problems for $t \geq 0$ + * individual persons' problems for $t \geq 0$ +* given the price system and the allocation, the government budget constraint is satisfied for all $t \geq 0$. ## Next steps @@ -351,10 +351,10 @@ As our special case of {eq}`eq:optconsplan`, we compute the following consumptio $$ -\begin{aligned} +\begin{align} C_{yt} & = \beta (1 - \tau_t) W_t \\ A_{t+1} &= (1-\beta) (1- \tau_t) W_t -\end{aligned} +\end{align} $$ Using {eq}`eq:firmfonc` and $A_t = K_t + D_t$, we obtain the following closed form transition law for capital: @@ -368,20 +368,20 @@ $$ (eq:Klawclosed) From {eq}`eq:Klawclosed` and the government budget constraint {eq}`eq:govbudgetsequence`, we compute **time-invariant** or **steady state values** $\hat K, \hat D, \hat T$: $$ -\begin{aligned} +\begin{align} \hat{K} &=\hat{K}\left(1-\hat{\tau}\right)\left(1-\alpha\right)\left(1-\beta\right) - \hat{D} \\ \hat{D} &= (1 + \hat{r}) \hat{D} + \hat{G} - \hat{T} \\ \hat{T} &= \hat{\tau} \hat{Y} + \hat{\tau} \hat{r} \hat{D} . -\end{aligned} +\end{align} $$ (eq:steadystates) These imply $$ -\begin{aligned} +\begin{align} \hat{K} &= \left[\left(1-\hat{\tau}\right)\left(1-\alpha\right)\left(1-\beta\right)\right]^{\frac{1}{1-\alpha}} \\ \hat{\tau} &= \frac{\hat{G} + \hat{r} \hat{D}}{\hat{Y} + \hat{r} \hat{D}} -\end{aligned} +\end{align} $$ Let's take an example in which @@ -392,28 +392,21 @@ Let's take an example in which Our formulas for steady-state values tell us that $$ -\begin{aligned} +\begin{align} \hat{D} &= 0 \\ \hat{G} &= 0.15 \hat{Y} \\ \hat{\tau} &= 0.15 \\ -\end{aligned} +\end{align} $$ -## Code - - -In addition to what’s in Anaconda, this lecture will need the following libraries: - -```{code-cell} ipython3 -!pip install --upgrade quantecon -``` +### Implementation ```{code-cell} ipython3 import numpy as np import matplotlib.pyplot as plt -from numba import jit, prange +from numba import njit from quantecon.optimize import brent_max ``` @@ -425,11 +418,11 @@ For parameters $\alpha = 0.3$ and $\beta = 0.5$, let's compute $\hat{K}$: α = 0.3 β = 0.5 -# steady state ̂τ +# steady states of τ and D τ_hat = 0.15 D_hat = 0. -# solve for steady state +# solve for steady state of K K_hat = ((1 - τ_hat) * (1 - α) * (1 - β)) ** (1 / (1 - α)) K_hat ``` @@ -438,26 +431,29 @@ Knowing $\hat K$, we can calculate other equilibrium objects. Let's first define some Python helper functions. ```{code-cell} ipython3 -@jit +@njit def K_to_Y(K, α): + return K ** α -@jit +@njit def K_to_r(K, α): + return α * K ** (α - 1) -@jit +@njit def K_to_W(K, α): + return (1 - α) * K ** α -@jit +@njit def K_to_C(K, D, τ, r, α, β): - # consumption for old + # optimal consumption for the old when δ=0 A = K + D Co = A * (1 + r * (1 - τ)) - # consumption for young + # optimal consumption for the young when δ=0 W = K_to_W(K, α) Cy = β * W * (1 - τ) @@ -478,7 +474,7 @@ G_hat = τ_hat * Y_hat G_hat ``` -We use the optimal consumption plans to find steady state consumption for young and old are given by the +We use the optimal consumption plans to find steady state consumptions for young and old ```{code-cell} ipython3 Cy_hat, Co_hat = K_to_C(K_hat, D_hat, τ_hat, r_hat, α, β) @@ -510,19 +506,19 @@ To make sense of our calculation, we'll treat $t=0$ as time when a huge unanti * new government policy sequences are eventually time-invariant in the sense that after some date $T >0$, each sequence is constant over time. * sudden revelation of a new government policy in the form of sequences starting at time $t=0$ -We assume that everyone, including old people at time $t=0$, know the new government policy sequence and choose accordingly. +We assume that everyone, including old people at time $t=0$, knows the new government policy sequence and chooses accordingly. -As the capital stock and other economy aggregates adjust to the fiscal policy change over time, the economy will approach a new steady state. +As the capital stock and other aggregates adjust to the fiscal policy change over time, the economy will approach a new steady state. We can find a transition path from an old steady state to a new steady state by employing a fixed-point algorithm in a space of sequences. But in our special case with its closed form solution, we have available a simpler and faster approach. -Here we define a Python class `ClosedFormTrans` that computes length $T$ transitional path of the economy in response to a particular fiscal policy change. +Here we define a Python class `ClosedFormTrans` that computes length $T$ transition path in response to a particular fiscal policy change. We choose $T$ large enough so that we have gotten very close to a new steady state after $T$ periods. @@ -530,11 +526,11 @@ The class takes three keyword arguments, `τ_pol`, `D_pol`, and `G_pol`. These are sequences of tax rate, government debt level, and government purchases, respectively. -In each policy experiment below, we will pass two out of three as inputs that fully depict a fiscal policy change. +In each policy experiment below, we will pass two out of three as inputs required to depict a fiscal policy. -We'll then compute the single remaining policy variable from the government budget constraint. +We'll then compute the single remaining undetermined policy variable from the government budget constraint. -When simulating the transitional paths, it is useful to distinguish what **state variables** at time $t$ such as $K_t, Y_t, D_t, W_t, r_t$ from **control variables** including $C_{yt}, C_{ot}, \tau_{t}, G_t$. +When we simulate transition paths, it is useful to distinguish **state variables** at time $t$ such as $K_t, Y_t, D_t, W_t, r_t$ from **control variables** that include $C_{yt}, C_{ot}, \tau_{t}, G_t$. ```{code-cell} ipython3 class ClosedFormTrans: @@ -679,7 +675,7 @@ class ClosedFormTrans: ax.set_xlabel('t') ``` -We can create an instance `closed` given model parameters $\{\alpha, \beta\}$ and use it for various fiscal policy experiments. +We can create an instance `closed` for model parameters $\{\alpha, \beta\}$ and use it for various fiscal policy experiments. ```{code-cell} ipython3 @@ -698,19 +694,19 @@ To illustrate the power of `ClosedFormTrans`, let's first experiment with the fo The following equations completely characterize the equilibrium transition path originating from the initial steady state $$ -\begin{aligned} +\begin{align} K_{t+1} &= K_{t}^{\alpha}\left(1-\tau_{t}\right)\left(1-\alpha\right)\left(1-\beta\right) - \bar{D} \\ \tau_{0} &= (1-\frac{1}{3}) \hat{\tau} \\ \bar{D} &= \hat{G} - \tau_0\hat{Y} \\ \quad\tau_{t} & =\frac{\hat{G}+r_{t} \bar{D}}{\hat{Y}+r_{t} \bar{D}} -\end{aligned} +\end{align} $$ -We can simulate the transition of the economy for $20$ periods, after which the economy will be fairly close to the new steady state. +We can simulate the transition for $20$ periods, after which the economy will be close to a new steady state. -The first step is to prepare sequences of policy variables that describe the fiscal policy change. +The first step is to prepare sequences of policy variables that describe fiscal policy. - In this example, we need to define sequences of government expenditure $\{G_t\}_{t=0}^{T}$ and debt level $\{D_t\}_{t=0}^{T+1}$ in advance, then pass them to the solver. +We must define sequences of government expenditure $\{G_t\}_{t=0}^{T}$ and debt level $\{D_t\}_{t=0}^{T+1}$ in advance, then pass them to the solver. ```{code-cell} ipython3 T = 20 @@ -727,7 +723,7 @@ D_seq = np.ones(T+2) * D_bar D_seq[0] = D_hat ``` -Let's use the `simulate` method of `closed` to obtain the dynamic transitions. +Let's use the `simulate` method of `closed` to compute dynamic transitions. Note that we leave `τ_pol` as `None`, since the tax rates need to be determined to satisfy the government budget constraint. @@ -738,7 +734,7 @@ quant_seq1, price_seq1, policy_seq1 = closed.simulate(T, init_ss, closed.plot() ``` -We can also easily experiment with a lower tax cut rate, such as $0.2$, and compare +We can also experiment with a lower tax cut rate, such as $0.2$. ```{code-cell} ipython3 # lower tax cut rate @@ -785,13 +781,18 @@ for i, name in enumerate(['τ', 'D', 'G']): ax.set_xlabel('t') ``` +The economy with lower tax cut rate at $t=0$ has the same transitional pattern, but is less distorted, and it converges to a new steady state with higher physical capital stock. + +(exp-expen-cut)= ### Experiment 2: Government asset accumulation -Assuming that the economy was in the same steady state, but instead of announcing a tax cut at $t=0$, the government now promises to cut its spending on services and goods by a half $\forall t \leq 0$. +Assume that the economy is initially in the same steady state. + +Now the government promises to cut its spending on services and goods by half $\forall t \geq 0$. -The government wants to target the same tax rate $\tau_t=\hat{\tau}$ and accumulate assets $-D_t$ over time. +The government targets the same tax rate $\tau_t=\hat{\tau}$ and to accumulate assets $-D_t$ over time. -Note that in this experiment, we pass `τ_seq` and `G_seq` as inputs, and let `D_pol` be determined along the path by satisfying the government budget constraint. +To conduct this experiment, we pass `τ_seq` and `G_seq` as inputs and let `D_pol` be determined along the path by satisfying the government budget constraint. ```{code-cell} ipython3 # government expenditure cut by a half @@ -804,21 +805,36 @@ closed.simulate(T, init_ss, τ_pol=τ_seq, G_pol=G_seq); closed.plot() ``` -It will be useful for understanding the transition paths by looking at the ratio of government asset to the output, $-\frac{D_t}{Y_t}$ +As the government accumulates the asset and uses it in production, the rental rate on capital falls and private investment falls. + +As a result, the ratio $-\frac{D_t}{K_t}$ of the government asset to physical capital used in production will increase over time ```{code-cell} ipython3 plt.plot(range(T+1), -closed.policy_seq[:-1, 1] / closed.quant_seq[:, 0]) plt.xlabel('t') -plt.title('-D/Y'); +plt.title('-D/K'); ``` +We want to know how this policy experiment affects individuals. + +In the long run, future cohorts will enjoy higher consumption throughout their lives because they will earn higher labor income when they work. + +However, in the short run, old people suffer because increases in their labor income are not big enough to offset their losses of capital income. + +Such distinct long run and short run effects motivate us to study transition paths. + +```{note} +Although the consumptions in the new steady state are strictly higher, it is at a cost of fewer public services and goods. +``` + + ### Experiment 3: Temporary expenditure cut -Let's now consider the case where the government also cuts its spending by half and accumulates asset. +Let's now investigate a scenario in which the government also cuts its spending by half and accumulates the asset. -But this time the expenditure cut only lasts for one period at $t=0$. +But now let the government cut its expenditures only at $t=0$. -From $t \geq 1$, the government will return to the original level of consumption $\hat{G}$, and will adjust $\tau_t$ to maintain the same level of asset $-D_t = -D_1$. +From $t \geq 1$, the government expeditures return to $\hat{G}$ and $\tau_t$ adjusts to maintain the asset level $-D_t = -D_1$. ```{code-cell} ipython3 # sequence of government purchase @@ -834,26 +850,35 @@ closed.simulate(T, init_ss, D_pol=D_seq, G_pol=G_seq); closed.plot() ``` +The economy quickly converges to a new steady state with higher physical capital stock, lower interest rate, higher wage rate, and higher consumptions for both the young and the old. + +Even though government expenditure $G_t$ returns to its high initial level from $t \geq 1$, the government can balance the budget at a lower tax rate because it gathers additional revenue $-r_t D_t$ from the asset accumulated during the temporary cut in the spendings. + +As in {ref}`exp-expen-cut`, old perople early in the transition periods suffer from this policy shock. ## A computational strategy -In the above illustrations, we studied dynamic transitions associated with various fiscal policy experiments. +With the preceding caluations, we studied dynamic transitions instigated by alternative fiscal policies. -In these experiments, we maintained the assumption that lump sum taxes are absent ($\delta_{yt}=0, \delta_{ot}=0$). +In all these experiments, we maintained the assumption that lump sum taxes were absent so that $\delta_{yt}=0, \delta_{ot}=0$. In this section, we investigate the transition dynamics when the lump sum taxes are present. The government will use lump sum taxes and transfers to redistribute resources across successive generations. -Including lump sum taxes will break down the closed form solution because now optimal consumption and saving plans will depend on future prices and tax rates. +Including lump sum taxes disrupts closed form solution because of how they make optimal consumption and saving plans depend on future prices and tax rates. -Therefore, we use a more general way of solving for equilibriunm transitional paths that involves computing them as a fixed point in a mapping from sequences to sequences. +Therefore, we compute equilibrium transitional paths by finding a fixed point of a mapping from sequences to sequences. -We elaborate on the equilibrium conditions as we define in section {ref}`sec-equilibrium`, which characterize the fixed point + * that fixed point pins down an equilibrium -**Definition:** Given model parameters $\{\alpha$, $\beta\}$, a competitive equilibrium consists of +To set the stage for the entry of the mapping whose fixed point we seek, we return to concepts introduced in + section {ref}`sec-equilibrium`. + + +**Definition:** Given parameters $\{\alpha$, $\beta\}$, a competitive equilibrium consists of * sequences of optimal consumptions $\{C_{yt}, C_{ot}\}$ * sequences of prices $\{W_t, r_t\}$ @@ -862,40 +887,40 @@ We elaborate on the equilibrium conditions as we define in section {ref}`sec-equ with the properties that -* given the price system and government fiscal policy, the household consumption plans are optimal +* given the price system and government fiscal policy, consumption plans are optimal * the government budget constraints are satisfied for all $t$ -An equilibrium transition path can be computed by "guessing and verifying" +An equilibrium transition path can be computed by "guessing and verifying" some endogenous sequences. In our {ref}`exp-tax-cut` example, sequences $\{D_t\}_{t=0}^{T}$ and $\{G_t\}_{t=0}^{T}$ are exogenous. -In addition, we assume that the lump sum taxes $\{\delta_{yt}, \delta_{ot}\}_{t=0}^{T}$ are given and known to the households. +In addition, we assume that the lump sum taxes $\{\delta_{yt}, \delta_{ot}\}_{t=0}^{T}$ are given and known to everybody inside the model. -We can solve for sequences of other equilibrium objects following the steps below +We can solve for sequences of other equilibrium sequences following the steps below -1. guesses prices $\{W_t, r_t\}_{t=0}^{T}$ and tax rates $\{\tau_t\}_{t=0}^{T}$ +1. guess prices $\{W_t, r_t\}_{t=0}^{T}$ and tax rates $\{\tau_t\}_{t=0}^{T}$ 2. solve for optimal consumption and saving plans $\{C_{yt}, C_{ot}\}_{t=0}^{T}$, treating the guesses of future prices and taxes as true -3. solve for transitional dynamics of the capital stock $\{K_t\}_{t=0}^{T}$ +3. solve for transition of the capital stock $\{K_t\}_{t=0}^{T}$ 4. update the guesses for prices and tax rates with the values implied by the equilibrium conditions 5. iterate until convergence -Below we implement the "guess and verify" computation. +Let's implement this "guess and verify" approach We start by defining the Cobb-Douglas utility function ```{code-cell} ipython3 -@jit +@njit def U(Cy, Co, β): return (Cy ** β) * (Co ** (1-β)) ``` -We use `Cy_val` to compute the lifetime value of choosing an arbitrary consumption plan, $C_y$, given the intertemporal budget constraint. +We use `Cy_val` to compute the lifetime value of an arbitrary consumption plan, $C_y$, given the intertemporal budget constraint. Note that it requires knowing future prices $r_{t+1}$ and tax rate $\tau_{t+1}$. ```{code-cell} ipython3 -@jit +@njit def Cy_val(Cy, W, r_next, τ, τ_next, δy, δo_next, β): # Co given by the budget constraint @@ -904,9 +929,9 @@ def Cy_val(Cy, W, r_next, τ, τ_next, δy, δo_next, β): return U(Cy, Co, β) ``` -The optimal consumption plan $C_y^*$ can be found by maximizing `Cy_val`. +An optimal consumption plan $C_y^*$ can be found by maximizing `Cy_val`. -Here is an example of finding the optimal consumption $C_y^*=\hat{C}_y$ in the steady state as we discussed before, with $\delta_{yt}=\delta_{ot}=0$ +Here is an example that computes optimal consumption $C_y^*=\hat{C}_y$ in the steady state with $\delta_{yt}=\delta_{ot}=0,$ like one that we studied earlier ```{code-cell} ipython3 W, r_next, τ, τ_next = W_hat, r_hat, τ_hat, τ_hat @@ -920,7 +945,9 @@ Cy_opt, U_opt, _ = brent_max(Cy_val, # maximand Cy_opt, U_opt ``` -Below we define a Python class `AK2` that solves for the transitional paths of the economy using the fixed-point algorithm. It can handle any fiscal policy experiment including nonzero lump sum taxations +Let's define a Python class `AK2` that computes the transition paths with the fixed-point algorithm. + +It can handle nonzero lump sum taxes ```{code-cell} ipython3 class AK2(): @@ -928,7 +955,7 @@ class AK2(): This class simulates length T transitional path of a economy in response to a fiscal policy change given its initial steady state. The transitional path is found by employing a fixed point - algorithm that and uses equilibrium conditions. + algorithm to satisfy the equilibrium conditions. """ @@ -994,7 +1021,9 @@ class AK2(): axs[i].plot(range(T+1), price_seq[:T+1, i]) axs[i].set_title(name) axs[i].set_xlabel('t') - axs[2].plot(range(T+1), policy_seq[:T+1, 0]) + axs[2].plot(range(T+1), policy_seq[:T+1, 0], + label=f'{i_iter}th iteration') + axs[2].legend(bbox_to_anchor=(1.05, 1), loc='upper left') axs[2].set_title('τ') axs[2].set_xlabel('t') @@ -1089,7 +1118,7 @@ class AK2(): ax.set_xlabel('t') ``` -We can initialize an instance of class `AK2` with model parameters $\{\alpha, \beta\}$ and then use it for various fiscal policy experiments. +We can initialize an instance of class `AK2` with model parameters $\{\alpha, \beta\}$ and then use it to conduct fiscal policy experiments. ```{code-cell} ipython3 ak2 = AK2(α, β) @@ -1122,13 +1151,13 @@ quant_seq3, price_seq3, policy_seq3 = ak2.simulate(T, init_ss, ak2.plot() ``` -Next, we can now try to turn on the lump sum taxes with the more general laboratory at hand. +Next, we activate lump sum taxes. -For example, let's try the same fiscal policy experiment in {ref}`exp-tax-cut`, but slightly modify it and assume that the government will in addition increase the lump sum taxes for both the young and old households $\delta_{yt}=\delta_{ot}=0.01, t\geq0$. +Let's alter our {ref}`exp-tax-cut` fiscal policy experiment by assuming that the government also increases lump sum taxes for both young and old people $\delta_{yt}=\delta_{ot}=0.005, t\geq0$. ```{code-cell} ipython3 -δy_seq = np.ones(T+2) * 0.01 -δo_seq = np.ones(T+2) * 0.01 +δy_seq = np.ones(T+2) * 0.005 +δo_seq = np.ones(T+2) * 0.005 D1 = D_hat * (1 + r_hat * (1 - τ0)) + G_hat - τ0 * Y_hat - δy_seq[0] - δo_seq[0] D_pol[1:] = D1 @@ -1138,7 +1167,7 @@ quant_seq4, price_seq4, policy_seq4 = ak2.simulate(T, init_ss, D_pol=D_pol, G_pol=G_pol) ``` -As a result, we see that the "crowding out" effect is mitigated. +Note how "crowding out" has been mitigated. ```{code-cell} ipython3 fig, axs = plt.subplots(3, 3, figsize=(14, 10)) @@ -1147,7 +1176,7 @@ fig, axs = plt.subplots(3, 3, figsize=(14, 10)) for i, name in enumerate(['K', 'Y', 'Cy', 'Co']): ax = axs[i//3, i%3] ax.plot(range(T+1), quant_seq3[:T+1, i], label=name+', $\delta$s=0') - ax.plot(range(T+1), quant_seq4[:T+1, i], label=name+', $\delta$s=0.01') + ax.plot(range(T+1), quant_seq4[:T+1, i], label=name+', $\delta$s=0.005') ax.hlines(init_ss[i], 0, T+1, color='r', linestyle='--') ax.legend() ax.set_xlabel('t') @@ -1156,7 +1185,7 @@ for i, name in enumerate(['K', 'Y', 'Cy', 'Co']): for i, name in enumerate(['W', 'r']): ax = axs[(i+4)//3, (i+4)%3] ax.plot(range(T+1), price_seq3[:T+1, i], label=name+', $\delta$s=0') - ax.plot(range(T+1), price_seq4[:T+1, i], label=name+', $\delta$s=0.01') + ax.plot(range(T+1), price_seq4[:T+1, i], label=name+', $\delta$s=0.005') ax.hlines(init_ss[i+4], 0, T+1, color='r', linestyle='--') ax.legend() ax.set_xlabel('t') @@ -1165,8 +1194,83 @@ for i, name in enumerate(['W', 'r']): for i, name in enumerate(['τ', 'D', 'G']): ax = axs[(i+6)//3, (i+6)%3] ax.plot(range(T+1), policy_seq3[:T+1, i], label=name+', $\delta$s=0') - ax.plot(range(T+1), policy_seq4[:T+1, i], label=name+', $\delta$s=0.01') + ax.plot(range(T+1), policy_seq4[:T+1, i], label=name+', $\delta$s=0.005') + ax.hlines(init_ss[i+6], 0, T+1, color='r', linestyle='--') + ax.legend() + ax.set_xlabel('t') +``` + +Comparing to {ref}`exp-tax-cut`, the government raises lump-sum taxes to finance the increasing debt interest payment, which is less distortionary comparing to raising the capital income tax rate. + + +### Experiment 4: Unfunded Social Security System + +In this experiment, lump-sum taxes are of equal magnitudes for old and the young, but of opposite signs. + +A negative lump-sum tax is a subsidy. + +Thus, in this experiment we tax the young and subsidize the old. + +We start the economy at the same initial steady state that we assumed in several earlier experiments. + +The government sets the lump sum taxes $\delta_{y,t}=-\delta_{o,t}=10\% \hat{C}_{y}$ starting from $t=0$. + +It keeps debt levels and expenditures at their steady state levels $\hat{D}$ and $\hat{G}$. + +In effect, this experiment amounts to launching an unfunded social security system. + +We can use our code to compute the transition ignited by launching this system. + +Let's compare the results to the {ref}`exp-tax-cut`. + +```{code-cell} ipython3 +δy_seq = np.ones(T+2) * Cy_hat * 0.1 +δo_seq = np.ones(T+2) * -Cy_hat * 0.1 + +D_pol[:] = D_hat + +quant_seq5, price_seq5, policy_seq5 = ak2.simulate(T, init_ss, + δy_seq, δo_seq, + D_pol=D_pol, G_pol=G_pol) +``` + +```{code-cell} ipython3 +fig, axs = plt.subplots(3, 3, figsize=(14, 10)) + +# quantities +for i, name in enumerate(['K', 'Y', 'Cy', 'Co']): + ax = axs[i//3, i%3] + ax.plot(range(T+1), quant_seq3[:T+1, i], label=name+', tax cut') + ax.plot(range(T+1), quant_seq5[:T+1, i], label=name+', transfer') + ax.hlines(init_ss[i], 0, T+1, color='r', linestyle='--') + ax.legend() + ax.set_xlabel('t') + +# prices +for i, name in enumerate(['W', 'r']): + ax = axs[(i+4)//3, (i+4)%3] + ax.plot(range(T+1), price_seq3[:T+1, i], label=name+', tax cut') + ax.plot(range(T+1), price_seq5[:T+1, i], label=name+', transfer') + ax.hlines(init_ss[i+4], 0, T+1, color='r', linestyle='--') + ax.legend() + ax.set_xlabel('t') + +# policies +for i, name in enumerate(['τ', 'D', 'G']): + ax = axs[(i+6)//3, (i+6)%3] + ax.plot(range(T+1), policy_seq3[:T+1, i], label=name+', tax cut') + ax.plot(range(T+1), policy_seq5[:T+1, i], label=name+', transfer') ax.hlines(init_ss[i+6], 0, T+1, color='r', linestyle='--') ax.legend() ax.set_xlabel('t') ``` + +An initial old person benefits especially when the social security system is launched because he receives a transfer but pays nothing for it. + +But in the long run, consumption rates of both young and old people decrease because the the social security system decreases incentives to save. + +That lowers the stock of physical capital and consequently lowers output. + +The government must then raise tax rate in order to pay for its expenditures. + +The higher rate on capital income further distorts incentives to save. From 047bd4b72c1c55dcfea23e62a9b8c0a3d6b47c36 Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 29 May 2024 19:05:49 +1000 Subject: [PATCH 2/4] move align to aligned for pdf output --- lectures/ak2.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lectures/ak2.md b/lectures/ak2.md index c71959d3..c01e56a1 100644 --- a/lectures/ak2.md +++ b/lectures/ak2.md @@ -218,10 +218,10 @@ $$ To maximize profits a firm equates marginal products to rental rates: $$ -\begin{align} +\begin{aligneded} W_t & = (1-\alpha) K_t^\alpha L_t^{-\alpha} \\ r_t & = \alpha K_t^\alpha L_t^{1-\alpha} -\end{align} +\end{aligneded} $$ (eq:firmfonc) Output can be consumed either by old people or young people; or sold to young people who use it to augment the capital stock; or sold to the government for uses that do not generate utility for the people in the model (i.e., ``it is thrown into the ocean''). @@ -274,10 +274,10 @@ $$ (eq:utilfn) subject to the following budget constraints at times $t$ and $t+1$: $$ -\begin{align} +\begin{aligned} C_{yt} + A_{t+1} & = W_t (1 - \tau_t) - \delta_{yt} \\ C_{ot+1} & = (1+ r_{t+1} (1 - \tau_{t+1}))A_{t+1} - \delta_{ot} -\end{align} +\end{aligned} $$ (eq:twobudgetc) @@ -290,9 +290,9 @@ $$ (eq:onebudgetc) To solve the young person's choice problem, form a Lagrangian $$ -\begin{align} +\begin{aligned} {\mathcal L} & = C_{yt}^\beta C_{o,t+1}^{1-\beta} \\ & + \lambda \Bigl[ 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})}\Bigr], -\end{align} +\end{aligned} $$ (eq:lagC) where $\lambda$ is a Lagrange multiplier on the intertemporal budget constraint {eq}`eq:onebudgetc`. @@ -302,10 +302,10 @@ After several lines of algebra, the intertemporal budget constraint {eq}`eq:oneb imply that an optimal consumption plan satisfies $$ -\begin{align} +\begin{aligned} C_{yt} & = \beta \Bigl[ W_t (1 - \tau_t) - \delta_{yt} - \frac{\delta_{ot}}{1 + r_{t+1}(1 - \tau_{t+1})}\Bigr] \\ \frac{C_{0t+1}}{1 + r_{t+1}(1-\tau_{t+1}) } & = (1-\beta) \Bigl[ W_t (1 - \tau_t) - \delta_{yt} - \frac{\delta_{ot}}{1 + r_{t+1}(1 - \tau_{t+1})}\Bigr] -\end{align} +\end{aligned} $$ (eq:optconsplan) The first-order condition for minimizing Lagrangian {eq}`eq:lagC` with respect to the Lagrange multipler $\lambda$ recovers the budget constraint {eq}`eq:onebudgetc`, @@ -351,10 +351,10 @@ As our special case of {eq}`eq:optconsplan`, we compute the following consumptio $$ -\begin{align} +\begin{aligned} C_{yt} & = \beta (1 - \tau_t) W_t \\ A_{t+1} &= (1-\beta) (1- \tau_t) W_t -\end{align} +\end{aligned} $$ Using {eq}`eq:firmfonc` and $A_t = K_t + D_t$, we obtain the following closed form transition law for capital: @@ -368,20 +368,20 @@ $$ (eq:Klawclosed) From {eq}`eq:Klawclosed` and the government budget constraint {eq}`eq:govbudgetsequence`, we compute **time-invariant** or **steady state values** $\hat K, \hat D, \hat T$: $$ -\begin{align} +\begin{aligned} \hat{K} &=\hat{K}\left(1-\hat{\tau}\right)\left(1-\alpha\right)\left(1-\beta\right) - \hat{D} \\ \hat{D} &= (1 + \hat{r}) \hat{D} + \hat{G} - \hat{T} \\ \hat{T} &= \hat{\tau} \hat{Y} + \hat{\tau} \hat{r} \hat{D} . -\end{align} +\end{aligned} $$ (eq:steadystates) These imply $$ -\begin{align} +\begin{aligned} \hat{K} &= \left[\left(1-\hat{\tau}\right)\left(1-\alpha\right)\left(1-\beta\right)\right]^{\frac{1}{1-\alpha}} \\ \hat{\tau} &= \frac{\hat{G} + \hat{r} \hat{D}}{\hat{Y} + \hat{r} \hat{D}} -\end{align} +\end{aligned} $$ Let's take an example in which @@ -392,11 +392,11 @@ Let's take an example in which Our formulas for steady-state values tell us that $$ -\begin{align} +\begin{aligned} \hat{D} &= 0 \\ \hat{G} &= 0.15 \hat{Y} \\ \hat{\tau} &= 0.15 \\ -\end{align} +\end{aligned} $$ @@ -694,12 +694,12 @@ To illustrate the power of `ClosedFormTrans`, let's first experiment with the fo The following equations completely characterize the equilibrium transition path originating from the initial steady state $$ -\begin{align} +\begin{aligned} K_{t+1} &= K_{t}^{\alpha}\left(1-\tau_{t}\right)\left(1-\alpha\right)\left(1-\beta\right) - \bar{D} \\ \tau_{0} &= (1-\frac{1}{3}) \hat{\tau} \\ \bar{D} &= \hat{G} - \tau_0\hat{Y} \\ \quad\tau_{t} & =\frac{\hat{G}+r_{t} \bar{D}}{\hat{Y}+r_{t} \bar{D}} -\end{align} +\end{aligned} $$ We can simulate the transition for $20$ periods, after which the economy will be close to a new steady state. From 5997cb4e09bd18c3742de3760c61399f6d0de1d7 Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 29 May 2024 19:29:22 +1000 Subject: [PATCH 3/4] fix aligneded --- lectures/ak2.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lectures/ak2.md b/lectures/ak2.md index c01e56a1..805aa600 100644 --- a/lectures/ak2.md +++ b/lectures/ak2.md @@ -37,6 +37,7 @@ Their model of two-period lived overlapping generations is a useful starting poi * it is good laboratory for studying connections between government tax and subsidy programs and for policies for issuing and servicing government debt * some interesting experiments involving transitions from one steady state to another can be computed by hand * it is a good setting for illustrating a **shooting method** for solving a system of non-linear difference equations with initial and terminal condition + ```{note} Auerbach and Kotlikoff use computer code to calculate transition paths for their models with long-lived people. ``` @@ -218,10 +219,10 @@ $$ To maximize profits a firm equates marginal products to rental rates: $$ -\begin{aligneded} +\begin{aligned} W_t & = (1-\alpha) K_t^\alpha L_t^{-\alpha} \\ r_t & = \alpha K_t^\alpha L_t^{1-\alpha} -\end{aligneded} +\end{aligned} $$ (eq:firmfonc) Output can be consumed either by old people or young people; or sold to young people who use it to augment the capital stock; or sold to the government for uses that do not generate utility for the people in the model (i.e., ``it is thrown into the ocean''). @@ -493,7 +494,9 @@ init_ss = np.array([K_hat, Y_hat, Cy_hat, Co_hat, # quantities ### Transitions + We have computed a steady state in which the government policy sequences are each constant over time. From 1e01896bedd7f2792871a37ffb96ac2816e0151c Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 29 May 2024 19:44:37 +1000 Subject: [PATCH 4/4] supress output from first code-cell --- lectures/ak2.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lectures/ak2.md b/lectures/ak2.md index 805aa600..67726502 100644 --- a/lectures/ak2.md +++ b/lectures/ak2.md @@ -16,6 +16,7 @@ kernelspec: In addition to what’s in Anaconda, this lecture will need the following libraries: ```{code-cell} ipython3 +:tags: [hide-output] !pip install --upgrade quantecon ```