{
"cells": [
{
"cell_type": "markdown",
"id": "9d74cd20",
"metadata": {},
"source": [
"\n",
""
]
},
{
"cell_type": "markdown",
"id": "8a415039",
"metadata": {},
"source": [
"# Tax Smoothing with Complete and Incomplete Markets\n",
"\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"id": "c3dc3667",
"metadata": {},
"source": [
"## Contents\n",
"\n",
"- [Tax Smoothing with Complete and Incomplete Markets](#Tax-Smoothing-with-Complete-and-Incomplete-Markets) \n",
" - [Overview](#Overview) \n",
" - [Tax Smoothing with Complete Markets](#Tax-Smoothing-with-Complete-Markets) \n",
" - [Returns on State-Contingent Debt](#Returns-on-State-Contingent-Debt) \n",
" - [More Finite Markov Chain Tax-Smoothing Examples](#More-Finite-Markov-Chain-Tax-Smoothing-Examples) "
]
},
{
"cell_type": "markdown",
"id": "bb184ef3",
"metadata": {},
"source": [
"In addition to what’s in Anaconda, this lecture uses the library:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "53bd95c7",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"!pip install --upgrade quantecon"
]
},
{
"cell_type": "markdown",
"id": "a1e60869",
"metadata": {},
"source": [
"## Overview\n",
"\n",
"This lecture describes tax-smoothing models that are counterparts to consumption-smoothing models in [Consumption Smoothing with Complete and Incomplete Markets](https://python-advanced.quantecon.org/smoothing.html).\n",
"\n",
"- one is in the **complete markets** tradition of Lucas and Stokey [[LS83](https://python-advanced.quantecon.org/zreferences.html#id176)]. \n",
"- the other is in the **incomplete markets** tradition of Barro [[Bar79](https://python-advanced.quantecon.org/zreferences.html#id136)]. \n",
"\n",
"\n",
"*Complete markets* allow a government to buy or sell claims contingent on all possible Markov states.\n",
"\n",
"*Incomplete markets* allow a government to buy or sell only a limited set of securities, often only a single risk-free security.\n",
"\n",
"Barro [[Bar79](https://python-advanced.quantecon.org/zreferences.html#id136)] worked in an incomplete markets tradition by assuming\n",
"that the only asset that can be traded is a risk-free one period bond.\n",
"\n",
"In his consumption-smoothing model, Hall [[Hal78](https://python-advanced.quantecon.org/zreferences.html#id152)] had assumed an exogenous stochastic process of nonfinancial income and\n",
"an exogenous gross interest rate on one period risk-free debt that equals\n",
"$ \\beta^{-1} $, where $ \\beta \\in (0,1) $ is also a consumer’s\n",
"intertemporal discount factor.\n",
"\n",
"Barro [[Bar79](https://python-advanced.quantecon.org/zreferences.html#id136)] made an analogous assumption about the risk-free interest\n",
"rate in a tax-smoothing model that turns out to have the same mathematical structure as Hall’s\n",
"consumption-smoothing model.\n",
"\n",
"To get Barro’s model from Hall’s, all we have to do is to rename variables.\n",
"\n",
"We maintain Hall’s and Barro’s assumption about the interest rate when we describe an\n",
"incomplete markets version of our model.\n",
"\n",
"In addition, we extend their assumption about the interest rate to an appropriate counterpart to create a “complete markets” model in the style of\n",
"Lucas and Stokey [[LS83](https://python-advanced.quantecon.org/zreferences.html#id176)]."
]
},
{
"cell_type": "markdown",
"id": "54738465",
"metadata": {},
"source": [
"### Isomorphism between Consumption and Tax Smoothing\n",
"\n",
"For each version of a consumption-smoothing model, a tax-smoothing counterpart can be obtained simply by relabeling\n",
"\n",
"- consumption as tax collections \n",
"- a consumer’s one-period utility function as a government’s one-period loss function from collecting taxes that impose deadweight welfare losses \n",
"- a consumer’s nonfinancial income as a government’s purchases \n",
"- a consumer’s *debt* as a government’s *assets* \n",
"\n",
"\n",
"Thus, we can convert the consumption-smoothing models in lecture [Consumption Smoothing with Complete and Incomplete Markets](https://python-advanced.quantecon.org/smoothing.html) into tax-smoothing models by setting\n",
"$ c_t = T_t $, $ y_t = G_t $, and $ - b_t = a_t $, where $ T_t $ is total tax\n",
"collections, $ \\{G_t\\} $ is an exogenous government expenditures\n",
"process, and $ a_t $ is the government’s holdings of one-period risk-free bonds coming maturing at the due at the beginning of time $ t $.\n",
"\n",
"For elaborations on this theme, please see [Optimal Savings II: LQ Techniques](https://python-intro.quantecon.org/perm_income_cons.html) and later parts of this lecture.\n",
"\n",
"We’ll spend most of this lecture studying acquire finite-state Markov specification,\n",
"but will also treat the linear state space specification."
]
},
{
"cell_type": "markdown",
"id": "7b17fb79",
"metadata": {},
"source": [
"#### Link to History\n",
"\n",
"For those who love history, President Thomas Jefferson’s Secretary of Treasury Albert Gallatin (1807) [[Gal37](https://python-advanced.quantecon.org/zreferences.html#id134)] seems to have prescribed policies that\n",
"come from Barro’s model [[Bar79](https://python-advanced.quantecon.org/zreferences.html#id136)]\n",
"\n",
"Let’s start with some standard imports:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0a10e713",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"import numpy as np\n",
"import quantecon as qe\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"import scipy.linalg as la"
]
},
{
"cell_type": "markdown",
"id": "467fe3ee",
"metadata": {},
"source": [
"To exploit the isomorphism between consumption-smoothing and tax-smoothing models, we simply use code from [Consumption Smoothing with Complete and Incomplete Markets](https://python-advanced.quantecon.org/smoothing.html)"
]
},
{
"cell_type": "markdown",
"id": "98e3a161",
"metadata": {},
"source": [
"### Code\n",
"\n",
"Among other things, this code contains a function called `consumption_complete()`.\n",
"\n",
"This function computes $ \\{ b(i) \\}_{i=1}^{N}, \\bar c $ as outcomes given a set of parameters for the general case with $ N $ Markov states\n",
"under the assumption of complete markets"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e67f3b39",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"class ConsumptionProblem:\n",
" \"\"\"\n",
" The data for a consumption problem, including some default values.\n",
" \"\"\"\n",
"\n",
" def __init__(self,\n",
" β=.96,\n",
" y=[2, 1.5],\n",
" b0=3,\n",
" P=[[.8, .2],\n",
" [.4, .6]],\n",
" init=0):\n",
" \"\"\"\n",
" Parameters\n",
" ----------\n",
"\n",
" β : discount factor\n",
" y : list containing the two income levels\n",
" b0 : debt in period 0 (= initial state debt level)\n",
" P : 2x2 transition matrix\n",
" init : index of initial state s0\n",
" \"\"\"\n",
" self.β = β\n",
" self.y = np.asarray(y)\n",
" self.b0 = b0\n",
" self.P = np.asarray(P)\n",
" self.init = init\n",
"\n",
" def simulate(self, N_simul=80, random_state=1):\n",
" \"\"\"\n",
" Parameters\n",
" ----------\n",
"\n",
" N_simul : number of periods for simulation\n",
" random_state : random state for simulating Markov chain\n",
" \"\"\"\n",
" # For the simulation define a quantecon MC class\n",
" mc = qe.MarkovChain(self.P)\n",
" s_path = mc.simulate(N_simul, init=self.init, random_state=random_state)\n",
"\n",
" return s_path\n",
"\n",
"\n",
"def consumption_complete(cp):\n",
" \"\"\"\n",
" Computes endogenous values for the complete market case.\n",
"\n",
" Parameters\n",
" ----------\n",
"\n",
" cp : instance of ConsumptionProblem\n",
"\n",
" Returns\n",
" -------\n",
"\n",
" c_bar : constant consumption\n",
" b : optimal debt in each state\n",
"\n",
" associated with the price system\n",
"\n",
" Q = β * P\n",
" \"\"\"\n",
" β, P, y, b0, init = cp.β, cp.P, cp.y, cp.b0, cp.init # Unpack\n",
"\n",
" Q = β * P # assumed price system\n",
"\n",
" # construct matrices of augmented equation system\n",
" n = P.shape[0] + 1\n",
"\n",
" y_aug = np.empty((n, 1))\n",
" y_aug[0, 0] = y[init] - b0\n",
" y_aug[1:, 0] = y\n",
"\n",
" Q_aug = np.zeros((n, n))\n",
" Q_aug[0, 1:] = Q[init, :]\n",
" Q_aug[1:, 1:] = Q\n",
"\n",
" A = np.zeros((n, n))\n",
" A[:, 0] = 1\n",
" A[1:, 1:] = np.eye(n-1)\n",
"\n",
" x = np.linalg.inv(A - Q_aug) @ y_aug\n",
"\n",
" c_bar = x[0, 0]\n",
" b = x[1:, 0]\n",
"\n",
" return c_bar, b\n",
"\n",
"\n",
"def consumption_incomplete(cp, s_path):\n",
" \"\"\"\n",
" Computes endogenous values for the incomplete market case.\n",
"\n",
" Parameters\n",
" ----------\n",
"\n",
" cp : instance of ConsumptionProblem\n",
" s_path : the path of states\n",
" \"\"\"\n",
" β, P, y, b0 = cp.β, cp.P, cp.y, cp.b0 # Unpack\n",
"\n",
" N_simul = len(s_path)\n",
"\n",
" # Useful variables\n",
" n = len(y)\n",
" y.shape = (n, 1)\n",
" v = np.linalg.inv(np.eye(n) - β * P) @ y\n",
"\n",
" # Store consumption and debt path\n",
" b_path, c_path = np.ones(N_simul+1), np.ones(N_simul)\n",
" b_path[0] = b0\n",
"\n",
" # Optimal decisions from (12) and (13)\n",
" db = ((1 - β) * v - y) / β\n",
"\n",
" for i, s in enumerate(s_path):\n",
" c_path[i] = (1 - β) * (v - np.full((n, 1), b_path[i]))[s, 0]\n",
" b_path[i + 1] = b_path[i] + db[s, 0]\n",
"\n",
" return c_path, b_path[:-1], y[s_path]"
]
},
{
"cell_type": "markdown",
"id": "32955f29",
"metadata": {},
"source": [
"### Revisiting the consumption-smoothing model\n",
"\n",
"The code above also contains a function called `consumption_incomplete()` that uses [(6.17)](https://python-advanced.quantecon.org/smoothing.html#equation-cs-12) and [(6.18)](https://python-advanced.quantecon.org/smoothing.html#equation-cs-13) to\n",
"\n",
"- simulate paths of $ y_t, c_t, b_{t+1} $ \n",
"- plot these against values of $ \\bar c, b(s_1), b(s_2) $ found in a corresponding complete markets economy \n",
"\n",
"\n",
"Let’s try this, using the same parameters in both complete and incomplete markets economies"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "80c430fc",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"cp = ConsumptionProblem()\n",
"s_path = cp.simulate()\n",
"N_simul = len(s_path)\n",
"\n",
"c_bar, debt_complete = consumption_complete(cp)\n",
"\n",
"c_path, debt_path, y_path = consumption_incomplete(cp, s_path)\n",
"\n",
"fig, ax = plt.subplots(1, 2, figsize=(14, 4))\n",
"\n",
"ax[0].set_title('Consumption paths')\n",
"ax[0].plot(np.arange(N_simul), c_path, label='incomplete market')\n",
"ax[0].plot(np.arange(N_simul), np.full(N_simul, c_bar), label='complete market')\n",
"ax[0].plot(np.arange(N_simul), y_path, label='income', alpha=.6, ls='--')\n",
"ax[0].legend()\n",
"ax[0].set_xlabel('Periods')\n",
"\n",
"ax[1].set_title('Debt paths')\n",
"ax[1].plot(np.arange(N_simul), debt_path, label='incomplete market')\n",
"ax[1].plot(np.arange(N_simul), debt_complete[s_path], label='complete market')\n",
"ax[1].plot(np.arange(N_simul), y_path, label='income', alpha=.6, ls='--')\n",
"ax[1].legend()\n",
"ax[1].axhline(0, color='k', ls='--')\n",
"ax[1].set_xlabel('Periods')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "40a81384",
"metadata": {},
"source": [
"In the graph on the left, for the same sample path of nonfinancial\n",
"income $ y_t $, notice that\n",
"\n",
"- consumption is constant when there are complete markets. \n",
"- consumption takes a random walk in the incomplete markets version of the model. \n",
"- the consumer’s debt oscillates between two values that are functions\n",
" of the Markov state in the complete markets model. \n",
"- the consumer’s debt drifts because it contains a unit root in the incomplete markets economy. "
]
},
{
"cell_type": "markdown",
"id": "6539b5f7",
"metadata": {},
"source": [
"#### Relabeling variables to create tax-smoothing models\n",
"\n",
"As indicated above, we relabel variables to acquire tax-smoothing interpretations of the complete markets and incomplete markets consumption-smoothing models."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0e71a1f2",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"fig, ax = plt.subplots(1, 2, figsize=(14, 4))\n",
"\n",
"ax[0].set_title('Tax collection paths')\n",
"ax[0].plot(np.arange(N_simul), c_path, label='incomplete market')\n",
"ax[0].plot(np.arange(N_simul), np.full(N_simul, c_bar), label='complete market')\n",
"ax[0].plot(np.arange(N_simul), y_path, label='govt expenditures', alpha=.6, ls='--')\n",
"ax[0].legend()\n",
"ax[0].set_xlabel('Periods')\n",
"ax[0].set_ylim([1.4, 2.1])\n",
"\n",
"ax[1].set_title('Government assets paths')\n",
"ax[1].plot(np.arange(N_simul), debt_path, label='incomplete market')\n",
"ax[1].plot(np.arange(N_simul), debt_complete[s_path], label='complete market')\n",
"ax[1].plot(np.arange(N_simul), y_path, label='govt expenditures', ls='--')\n",
"ax[1].legend()\n",
"ax[1].axhline(0, color='k', ls='--')\n",
"ax[1].set_xlabel('Periods')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "b34ece26",
"metadata": {},
"source": [
"## Tax Smoothing with Complete Markets\n",
"\n",
"It is instructive to focus on a simple tax-smoothing example with complete markets.\n",
"\n",
"This example illustrates how, in a complete markets model like that of Lucas and Stokey [[LS83](https://python-advanced.quantecon.org/zreferences.html#id176)], the government purchases\n",
"insurance from the private sector.\n",
"\n",
"Payouts from the insurance it had purchased allows the government to avoid raising taxes when emergencies make government expenditures surge.\n",
"\n",
"We assume that government expenditures take one of two values $ G_1 < G_2 $, where Markov state $ 1 $ means “peace” and Markov state $ 2 $ means “war”.\n",
"\n",
"The government budget constraint in Markov state $ i $ is\n",
"\n",
"$$\n",
"T_i + b_i = G_i + \\sum_j Q_{ij} b_j\n",
"$$\n",
"\n",
"where\n",
"\n",
"$$\n",
"Q_{ij} = \\beta P_{ij}\n",
"$$\n",
"\n",
"is the price today of one unit of goods in Markov state $ j $ tomorrow when\n",
"the Markov state is $ i $ today.\n",
"\n",
"$ b_i $ is the government’s level of *assets* when it arrives in Markov state $ i $.\n",
"\n",
"That is, $ b_i $ equals one-period state-contingent claims *owed to the government* that fall due at time $ t $ when the Markov state is $ i $.\n",
"\n",
"Thus, if $ b_i < 0 $, it means the government **is owed** $ b_i $ or **owes** $ -b_i $ when the economy arrives in Markov state $ i $ at time\n",
"$ t $.\n",
"\n",
"In our examples below, this happens when in a previous war-time period the government has sold an Arrow securities paying off $ - b_i $\n",
"in peacetime Markov state $ i $\n",
"\n",
"It can be enlightening to express the government’s budget constraint in Markov state $ i $ as\n",
"\n",
"$$\n",
"T_i = G_i + \\left(\\sum_j Q_{ij} b_j - b_i\\right)\n",
"$$\n",
"\n",
"in which the term $ (\\sum_j Q_{ij} b_j - b_i) $ equals the net amount that the government spends to purchase one-period Arrow securities\n",
"that will pay off next period in Markov states $ j = 1, \\ldots, N $ after it has received payments $ b_i $ this period."
]
},
{
"cell_type": "markdown",
"id": "309deb27",
"metadata": {},
"source": [
"## Returns on State-Contingent Debt\n",
"\n",
"Notice that $ \\sum_{j'=1}^N Q_{ij'} b(j') $ is the amount that the government spends in Markov state $ i $ at time $ t $ to purchase\n",
"one-period state-contingent claims that will pay off in Markov state $ j' $ at time $ t+1 $.\n",
"\n",
"Then the *ex post* one-period gross return on the portfolio of government assets held from state $ i $ at time $ t $\n",
"to state $ j $ at time $ t+1 $ is\n",
"\n",
"$$\n",
"R(j | i) = \\frac{b(j) }{ \\sum_{j'=1}^N Q_{ij'} b(j') }\n",
"$$\n",
"\n",
"The cumulative return earned from putting $ 1 $ unit of time $ t $ goods into the government portfolio of state-contingent securities at\n",
"time $ t $ and then rolling over the proceeds into the government portfolio each period thereafter is\n",
"\n",
"$$\n",
"R^T(s_{t+T}, s_{t+T-1}, \\ldots, s_t) \\equiv R(s_{t+1} | s_t) R (s_{t+2} | s_{t+1} )\n",
"\\cdots R(s_{t+T} | s_{t+T-1} )\n",
"$$\n",
"\n",
"Here is some code that computes one-period and cumulative returns on the government portfolio in the finite-state Markov version of our complete\n",
"markets model.\n",
"\n",
"**Convention:** In this code, when $ P_{ij}=0 $, we arbitrarily set $ R(j | i) $ to be $ 0 $."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8d2991e6",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"def ex_post_gross_return(b, cp):\n",
" \"\"\"\n",
" calculate the ex post one-period gross return on the portfolio\n",
" of government assets, given b and Q.\n",
" \"\"\"\n",
" Q = cp.β * cp.P\n",
"\n",
" values = Q @ b\n",
"\n",
" n = len(b)\n",
" R = np.zeros((n, n))\n",
"\n",
" for i in range(n):\n",
" ind = cp.P[i, :] != 0\n",
" R[i, ind] = b[ind] / values[i]\n",
"\n",
" return R\n",
"\n",
"def cumulative_return(s_path, R):\n",
" \"\"\"\n",
" compute cumulative return from holding 1 unit market portfolio\n",
" of government bonds, given some simulated state path.\n",
" \"\"\"\n",
" T = len(s_path)\n",
"\n",
" RT_path = np.empty(T)\n",
" RT_path[0] = 1\n",
" RT_path[1:] = np.cumprod([R[s_path[t], s_path[t+1]] for t in range(T-1)])\n",
"\n",
" return RT_path"
]
},
{
"cell_type": "markdown",
"id": "70bd3d16",
"metadata": {},
"source": [
"### An Example of Tax Smoothing\n",
"\n",
"We’ll study a tax-smoothing model with two Markov states.\n",
"\n",
"In Markov state $ 1 $, there is peace and government expenditures are low.\n",
"\n",
"In Markov state $ 2 $, there is war and government expenditures are high.\n",
"\n",
"We’ll compute optimal policies in both complete and incomplete markets settings.\n",
"\n",
"Then we’ll feed in a **particular** assumed path of Markov states and study outcomes.\n",
"\n",
"- We’ll assume that the initial Markov state is state $ 1 $, which means we start from a state of peace. \n",
"- The government then experiences 3 time periods of war and come back to peace again. \n",
"- The history of Markov states is therefore $ \\{ peace, war, war, war, peace \\} $. \n",
"\n",
"\n",
"In addition, as indicated above, to simplify our example, we’ll set the government’s initial\n",
"asset level to $ 1 $, so that $ b_1 = 1 $.\n",
"\n",
"Here’s code that itinitializes government assets to be unity in an initial peace time Markov state."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "19a3a185",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# Parameters\n",
"β = .96\n",
"\n",
"# change notation y to g in the tax-smoothing example\n",
"g = [1, 2]\n",
"b0 = 1\n",
"P = np.array([[.8, .2],\n",
" [.4, .6]])\n",
"\n",
"cp = ConsumptionProblem(β, g, b0, P)\n",
"Q = β * P\n",
"\n",
"# change notation c_bar to T_bar in the tax-smoothing example\n",
"T_bar, b = consumption_complete(cp)\n",
"R = ex_post_gross_return(b, cp)\n",
"s_path = [0, 1, 1, 1, 0]\n",
"RT_path = cumulative_return(s_path, R)\n",
"\n",
"print(f\"P \\n {P}\")\n",
"print(f\"Q \\n {Q}\")\n",
"print(f\"Govt expenditures in peace and war = {g}\")\n",
"print(f\"Constant tax collections = {T_bar}\")\n",
"print(f\"Govt debts in two states = {-b}\")\n",
"\n",
"msg = \"\"\"\n",
"Now let's check the government's budget constraint in peace and war.\n",
"Our assumptions imply that the government always purchases 0 units of the\n",
"Arrow peace security.\n",
"\"\"\"\n",
"print(msg)\n",
"\n",
"AS1 = Q[0, :] @ b\n",
"# spending on Arrow security\n",
"# since the spending on Arrow peace security is not 0 anymore after we change b0 to 1\n",
"print(f\"Spending on Arrow security in peace = {AS1}\")\n",
"AS2 = Q[1, :] @ b\n",
"print(f\"Spending on Arrow security in war = {AS2}\")\n",
"\n",
"print(\"\")\n",
"# tax collections minus debt levels\n",
"print(\"Government tax collections minus debt levels in peace and war\")\n",
"TB1 = T_bar + b[0]\n",
"print(f\"T+b in peace = {TB1}\")\n",
"TB2 = T_bar + b[1]\n",
"print(f\"T+b in war = {TB2}\")\n",
"\n",
"print(\"\")\n",
"print(\"Total government spending in peace and war\")\n",
"G1 = g[0] + AS1\n",
"G2 = g[1] + AS2\n",
"print(f\"Peace = {G1}\")\n",
"print(f\"War = {G2}\")\n",
"\n",
"print(\"\")\n",
"print(\"Let's see ex-post and ex-ante returns on Arrow securities\")\n",
"\n",
"Π = np.reciprocal(Q)\n",
"exret = Π\n",
"print(f\"Ex-post returns to purchase of Arrow securities = \\n {exret}\")\n",
"exant = Π * P\n",
"print(f\"Ex-ante returns to purchase of Arrow securities \\n {exant}\")\n",
"\n",
"print(\"\")\n",
"print(\"The Ex-post one-period gross return on the portfolio of government assets\")\n",
"print(R)\n",
"\n",
"print(\"\")\n",
"print(\"The cumulative return earned from holding 1 unit market portfolio of government bonds\")\n",
"print(RT_path[-1])"
]
},
{
"cell_type": "markdown",
"id": "1610d345",
"metadata": {},
"source": [
"### Explanation\n",
"\n",
"In this example, the government always purchase $ 1 $ units of the\n",
"Arrow security that pays off in peace time (Markov state $ 1 $).\n",
"\n",
"And it purchases a higher amount of the security that pays off in war\n",
"time (Markov state $ 2 $).\n",
"\n",
"Thus, this is an example in which\n",
"\n",
"- during peacetime, the government purchases *insurance* against the possibility that war breaks out next period \n",
"- during wartime, the government purchases *insurance* against the possibility that war continues another period \n",
"- so long as peace continues, the ex post return on insurance against war is low \n",
"- when war breaks out or continues, the ex post return on insurance against war is high \n",
"- given the history of states that we assumed, the value of one unit of the portfolio of government assets eventually doubles in the end because of high returns during wartime. \n",
"\n",
"\n",
"We recommend plugging the quantities computed above into the government\n",
"budget constraints in the two Markov states and staring."
]
},
{
"cell_type": "markdown",
"id": "2c4dc876",
"metadata": {},
"source": [
"### Exercise 7.1\n",
"\n",
"Try changing the Markov transition matrix so that\n",
"\n",
"$$\n",
"P = \\begin{bmatrix}\n",
" 1 & 0 \\\\\n",
" .2 & .8\n",
" \\end{bmatrix}\n",
"$$\n",
"\n",
"Also, start the system in Markov state $ 2 $ (war) with initial\n",
"government assets $ - 10 $, so that the government starts the\n",
"war in debt and $ b_2 = -10 $."
]
},
{
"cell_type": "markdown",
"id": "356a47a0",
"metadata": {},
"source": [
"## More Finite Markov Chain Tax-Smoothing Examples\n",
"\n",
"To interpret some episodes in the fiscal history of the United States, we find it interesting to study a few more examples.\n",
"\n",
"We compute examples in an $ N $ state Markov setting under both complete and incomplete markets.\n",
"\n",
"These examples differ in how Markov states are jumping between peace and war.\n",
"\n",
"To wrap procedures for solving models, relabeling graphs so that we record government *debt* rather than government *assets*,\n",
"and displaying results, we construct a Python class."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8a81fdab",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"class TaxSmoothingExample:\n",
" \"\"\"\n",
" construct a tax-smoothing example, by relabeling consumption problem class.\n",
" \"\"\"\n",
" def __init__(self, g, P, b0, states, β=.96,\n",
" init=0, s_path=None, N_simul=80, random_state=1):\n",
"\n",
" self.states = states # state names\n",
"\n",
" # if the path of states is not specified\n",
" if s_path is None:\n",
" self.cp = ConsumptionProblem(β, g, b0, P, init=init)\n",
" self.s_path = self.cp.simulate(N_simul=N_simul, random_state=random_state)\n",
" # if the path of states is specified\n",
" else:\n",
" self.cp = ConsumptionProblem(β, g, b0, P, init=s_path[0])\n",
" self.s_path = s_path\n",
"\n",
" # solve for complete market case\n",
" self.T_bar, self.b = consumption_complete(self.cp)\n",
" self.debt_value = - (β * P @ self.b).T\n",
"\n",
" # solve for incomplete market case\n",
" self.T_path, self.asset_path, self.g_path = \\\n",
" consumption_incomplete(self.cp, self.s_path)\n",
"\n",
" # calculate returns on state-contingent debt\n",
" self.R = ex_post_gross_return(self.b, self.cp)\n",
" self.RT_path = cumulative_return(self.s_path, self.R)\n",
"\n",
" def display(self):\n",
"\n",
" # plot graphs\n",
" N = len(self.T_path)\n",
"\n",
" plt.figure()\n",
" plt.title('Tax collection paths')\n",
" plt.plot(np.arange(N), self.T_path, label='incomplete market')\n",
" plt.plot(np.arange(N), np.full(N, self.T_bar), label='complete market')\n",
" plt.plot(np.arange(N), self.g_path, label='govt expenditures', alpha=.6, ls='--')\n",
" plt.legend()\n",
" plt.xlabel('Periods')\n",
" plt.show()\n",
"\n",
" plt.title('Government debt paths')\n",
" plt.plot(np.arange(N), -self.asset_path, label='incomplete market')\n",
" plt.plot(np.arange(N), -self.b[self.s_path], label='complete market')\n",
" plt.plot(np.arange(N), self.g_path, label='govt expenditures', ls='--')\n",
" plt.plot(np.arange(N), self.debt_value[self.s_path], label=\"value of debts today\")\n",
" plt.legend()\n",
" plt.axhline(0, color='k', ls='--')\n",
" plt.xlabel('Periods')\n",
" plt.show()\n",
"\n",
" fig, ax = plt.subplots()\n",
" ax.set_title('Cumulative return path (complete markets)')\n",
" line1 = ax.plot(np.arange(N), self.RT_path)[0]\n",
" c1 = line1.get_color()\n",
" ax.set_xlabel('Periods')\n",
" ax.set_ylabel('Cumulative return', color=c1)\n",
"\n",
" ax_ = ax.twinx()\n",
" ax_._get_lines.prop_cycler = ax._get_lines.prop_cycler\n",
" line2 = ax_.plot(np.arange(N), self.g_path, ls='--')[0]\n",
" c2 = line2.get_color()\n",
" ax_.set_ylabel('Government expenditures', color=c2)\n",
"\n",
" plt.show()\n",
"\n",
" # plot detailed information\n",
" Q = self.cp.β * self.cp.P\n",
"\n",
" print(f\"P \\n {self.cp.P}\")\n",
" print(f\"Q \\n {Q}\")\n",
" print(f\"Govt expenditures in {', '.join(self.states)} = {self.cp.y.flatten()}\")\n",
" print(f\"Constant tax collections = {self.T_bar}\")\n",
" print(f\"Govt debt in {len(self.states)} states = {-self.b}\")\n",
"\n",
" print(\"\")\n",
" print(f\"Government tax collections minus debt levels in {', '.join(self.states)}\")\n",
" for i in range(len(self.states)):\n",
" TB = self.T_bar + self.b[i]\n",
" print(f\" T+b in {self.states[i]} = {TB}\")\n",
"\n",
" print(\"\")\n",
" print(f\"Total government spending in {', '.join(self.states)}\")\n",
" for i in range(len(self.states)):\n",
" G = self.cp.y[i, 0] + Q[i, :] @ self.b\n",
" print(f\" {self.states[i]} = {G}\")\n",
"\n",
" print(\"\")\n",
" print(\"Let's see ex-post and ex-ante returns on Arrow securities \\n\")\n",
"\n",
" print(f\"Ex-post returns to purchase of Arrow securities:\")\n",
" for i in range(len(self.states)):\n",
" for j in range(len(self.states)):\n",
" if Q[i, j] != 0.:\n",
" print(f\" π({self.states[j]}|{self.states[i]}) = {1/Q[i, j]}\")\n",
"\n",
" print(\"\")\n",
" exant = 1 / self.cp.β\n",
" print(f\"Ex-ante returns to purchase of Arrow securities = {exant}\")\n",
"\n",
" print(\"\")\n",
" print(\"The Ex-post one-period gross return on the portfolio of government assets\")\n",
" print(self.R)\n",
"\n",
" print(\"\")\n",
" print(\"The cumulative return earned from holding 1 unit market portfolio of government bonds\")\n",
" print(self.RT_path[-1])"
]
},
{
"cell_type": "markdown",
"id": "feec215c",
"metadata": {},
"source": [
"### Parameters"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6eb1e81f",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"γ = .1\n",
"λ = .1\n",
"ϕ = .1\n",
"θ = .1\n",
"ψ = .1\n",
"g_L = .5\n",
"g_M = .8\n",
"g_H = 1.2\n",
"β = .96"
]
},
{
"cell_type": "markdown",
"id": "6fc02869",
"metadata": {},
"source": [
"### Example 1\n",
"\n",
"This example is designed to produce some stylized versions of tax, debt, and deficit paths followed by the United States during and\n",
"after the Civil War and also during and after World War I.\n",
"\n",
"We set the Markov chain to have three states\n",
"\n",
"$$\n",
"P =\n",
"\\begin{bmatrix}\n",
" 1 - \\lambda & \\lambda & 0 \\cr\n",
" 0 & 1 - \\phi & \\phi \\cr\n",
" 0 & 0 & 1\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"where the government expenditure vector $ g = \\begin{bmatrix} g_L & g_H & g_M \\end{bmatrix} $ where $ g_L < g_M < g_H $.\n",
"\n",
"We set $ b_0 = 1 $ and assume that the initial Markov state is state $ 1 $ so that the system starts off in peace.\n",
"\n",
"These parameters have government expenditure beginning at a low level, surging during the war, then decreasing after the war to a level\n",
"that exceeds its prewar level.\n",
"\n",
"(This type of pattern occurred in the US Civil War and World War I experiences.)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4125d655",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"g_ex1 = [g_L, g_H, g_M]\n",
"P_ex1 = np.array([[1-λ, λ, 0],\n",
" [0, 1-ϕ, ϕ],\n",
" [0, 0, 1]])\n",
"b0_ex1 = 1\n",
"states_ex1 = ['peace', 'war', 'postwar']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b77392cc",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"ts_ex1 = TaxSmoothingExample(g_ex1, P_ex1, b0_ex1, states_ex1, random_state=1)\n",
"ts_ex1.display()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6cc7a615",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# The following shows the use of the wrapper class when a specific state path is given\n",
"s_path = [0, 0, 1, 1, 2]\n",
"ts_s_path = TaxSmoothingExample(g_ex1, P_ex1, b0_ex1, states_ex1, s_path=s_path)\n",
"ts_s_path.display()"
]
},
{
"cell_type": "markdown",
"id": "5ff4bcf1",
"metadata": {},
"source": [
"### Example 2\n",
"\n",
"This example captures a peace followed by a war, eventually followed by a permanent peace .\n",
"\n",
"Here we set\n",
"\n",
"$$\n",
"P =\n",
"\\begin{bmatrix}\n",
" 1 & 0 & 0 \\cr\n",
" 0 & 1-\\gamma & \\gamma \\cr\n",
" \\phi & 0 & 1-\\phi\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"where the government expenditure vector $ g = \\begin{bmatrix} g_L & g_L & g_H \\end{bmatrix} $ and where $ g_L < g_H $.\n",
"\n",
"We assume $ b_0 = 1 $ and that the initial Markov state is state $ 2 $ so that the system starts off in a temporary peace."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "46b56883",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"g_ex2 = [g_L, g_L, g_H]\n",
"P_ex2 = np.array([[1, 0, 0],\n",
" [0, 1-γ, γ],\n",
" [ϕ, 0, 1-ϕ]])\n",
"b0_ex2 = 1\n",
"states_ex2 = ['peace', 'temporary peace', 'war']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ef77c8be",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"ts_ex2 = TaxSmoothingExample(g_ex2, P_ex2, b0_ex2, states_ex2, init=1, random_state=1)\n",
"ts_ex2.display()"
]
},
{
"cell_type": "markdown",
"id": "33526c2c",
"metadata": {},
"source": [
"### Example 3\n",
"\n",
"This example features a situation in which one of the states is a war state with no hope of peace next period, while another state\n",
"is a war state with a positive probability of peace next period.\n",
"\n",
"The Markov chain is:\n",
"\n",
"$$\n",
"P =\n",
"\\begin{bmatrix}\n",
" 1 - \\lambda & \\lambda & 0 & 0 \\cr\n",
" 0 & 1 - \\phi & \\phi & 0 \\cr\n",
" 0 & 0 & 1-\\psi & \\psi \\cr\n",
" \\theta & 0 & 0 & 1 - \\theta\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"with government expenditure levels for the four states being\n",
"$ \\begin{bmatrix} g_L & g_L & g_H & g_H \\end{bmatrix} $ where $ g_L < g_H $.\n",
"\n",
"We start with $ b_0 = 1 $ and $ s_0 = 1 $."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d614b8da",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"g_ex3 = [g_L, g_L, g_H, g_H]\n",
"P_ex3 = np.array([[1-λ, λ, 0, 0],\n",
" [0, 1-ϕ, ϕ, 0],\n",
" [0, 0, 1-ψ, ψ],\n",
" [θ, 0, 0, 1-θ ]])\n",
"b0_ex3 = 1\n",
"states_ex3 = ['peace1', 'peace2', 'war1', 'war2']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f69768e0",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"ts_ex3 = TaxSmoothingExample(g_ex3, P_ex3, b0_ex3, states_ex3, random_state=1)\n",
"ts_ex3.display()"
]
},
{
"cell_type": "markdown",
"id": "76d1d844",
"metadata": {},
"source": [
"### Example 4\n",
"\n",
"Here the Markov chain is:\n",
"\n",
"$$\n",
"P =\n",
"\\begin{bmatrix}\n",
" 1 - \\lambda & \\lambda & 0 & 0 & 0 \\cr\n",
" 0 & 1 - \\phi & \\phi & 0 & 0 \\cr\n",
" 0 & 0 & 1-\\psi & \\psi & 0 \\cr\n",
" 0 & 0 & 0 & 1 - \\theta & \\theta \\cr\n",
" 0 & 0 & 0 & 0 & 1\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"with government expenditure levels for the five states being\n",
"$ \\begin{bmatrix} g_L & g_L & g_H & g_H & g_L \\end{bmatrix} $ where $ g_L < g_H $.\n",
"\n",
"We ssume that $ b_0 = 1 $ and $ s_0 = 1 $."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fa05d5de",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"g_ex4 = [g_L, g_L, g_H, g_H, g_L]\n",
"P_ex4 = np.array([[1-λ, λ, 0, 0, 0],\n",
" [0, 1-ϕ, ϕ, 0, 0],\n",
" [0, 0, 1-ψ, ψ, 0],\n",
" [0, 0, 0, 1-θ, θ],\n",
" [0, 0, 0, 0, 1]])\n",
"b0_ex4 = 1\n",
"states_ex4 = ['peace1', 'peace2', 'war1', 'war2', 'permanent peace']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fd5dc11f",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"ts_ex4 = TaxSmoothingExample(g_ex4, P_ex4, b0_ex4, states_ex4, random_state=1)\n",
"ts_ex4.display()"
]
},
{
"cell_type": "markdown",
"id": "6a0c0212",
"metadata": {},
"source": [
"### Example 5\n",
"\n",
"The example captures a case when the system follows a deterministic path from peace to war, and back to peace again.\n",
"\n",
"Since there is no randomness, the outcomes in complete markets setting should be the same as in incomplete markets setting.\n",
"\n",
"The Markov chain is:\n",
"\n",
"$$\n",
"P =\n",
"\\begin{bmatrix}\n",
" 0 & 1 & 0 & 0 & 0 & 0 & 0 \\cr\n",
" 0 & 0 & 1 & 0 & 0 & 0 & 0 \\cr\n",
" 0 & 0 & 0 & 1 & 0 & 0 & 0 \\cr\n",
" 0 & 0 & 0 & 0 & 1 & 0 & 0 \\cr\n",
" 0 & 0 & 0 & 0 & 0 & 1 & 0 \\cr\n",
" 0 & 0 & 0 & 0 & 0 & 0 & 1 \\cr\n",
" 0 & 0 & 0 & 0 & 0 & 0 & 1 \\cr\n",
"\\end{bmatrix}\n",
"$$\n",
"\n",
"with government expenditure levels for the seven states being\n",
"$ \\begin{bmatrix} g_L & g_L & g_H & g_H & g_H & g_H & g_L \\end{bmatrix} $ where\n",
"$ g_L < g_H $. Assume $ b_0 = 1 $ and $ s_0 = 1 $."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "604812f3",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"g_ex5 = [g_L, g_L, g_H, g_H, g_H, g_H, g_L]\n",
"P_ex5 = np.array([[0, 1, 0, 0, 0, 0, 0],\n",
" [0, 0, 1, 0, 0, 0, 0],\n",
" [0, 0, 0, 1, 0, 0, 0],\n",
" [0, 0, 0, 0, 1, 0, 0],\n",
" [0, 0, 0, 0, 0, 1, 0],\n",
" [0, 0, 0, 0, 0, 0, 1],\n",
" [0, 0, 0, 0, 0, 0, 1]])\n",
"b0_ex5 = 1\n",
"states_ex5 = ['peace1', 'peace2', 'war1', 'war2', 'war3', 'permanent peace']"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fc14e4d2",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"ts_ex5 = TaxSmoothingExample(g_ex5, P_ex5, b0_ex5, states_ex5, N_simul=7, random_state=1)\n",
"ts_ex5.display()"
]
},
{
"cell_type": "markdown",
"id": "0a958cdb",
"metadata": {},
"source": [
"### Continuous-State Gaussian Model\n",
"\n",
"To construct a tax-smoothing version of the complete markets consumption-smoothing model with a continuous state space that we presented in\n",
"the lecture [consumption smoothing with complete and incomplete markets](https://python-advanced.quantecon.org/smoothing.html), we simply relabel variables.\n",
"\n",
"Thus, a government faces a sequence of budget constraints\n",
"\n",
"$$\n",
"T_t + b_t = g_t + \\beta \\mathbb E_t b_{t+1}, \\quad t \\geq 0\n",
"$$\n",
"\n",
"where $ T_t $ is tax revenues, $ b_t $ are receipts at $ t $ from contingent claims that the government had *purchased* at time $ t-1 $,\n",
"and\n",
"\n",
"$$\n",
"\\beta \\mathbb E_t b_{t+1} \\equiv \\int q_{t+1}(x_{t+1} | x_t) b_{t+1}(x_{t+1}) d x_{t+1}\n",
"$$\n",
"\n",
"is the value of time $ t+1 $ state-contingent claims purchased by the government at time $ t $.\n",
"\n",
"As above with the consumption-smoothing model, we can solve the time $ t $ budget constraint forward to obtain\n",
"\n",
"$$\n",
"b_t = \\mathbb E_t \\sum_{j=0}^\\infty \\beta^j (g_{t+j} - T_{t+j} )\n",
"$$\n",
"\n",
"which can be rearranged to become\n",
"\n",
"$$\n",
"\\mathbb E_t \\sum_{j=0}^\\infty \\beta^j g_{t+j} = b_t + \\mathbb E_t \\sum_{j=0}^\\infty \\beta^j T_{t+j}\n",
"$$\n",
"\n",
"which states that the present value of government purchases equals the value of government assets at $ t $ plus the present value of tax\n",
"receipts.\n",
"\n",
"With these relabelings, examples presented in [consumption smoothing with complete and incomplete markets](https://python-advanced.quantecon.org/smoothing.html) can be\n",
"interpreted as tax-smoothing models.\n",
"\n",
"**Returns:** In the continuous state version of our incomplete markets model, the ex post one-period gross rate of return on the government portfolio equals\n",
"\n",
"$$\n",
"R(x_{t+1} | x_t) = \\frac{b(x_{t+1})}{\\beta E b(x_{t+1})| x_t}\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "e0e2318a",
"metadata": {},
"source": [
"#### Related Lectures\n",
"\n",
"Throughout this lecture, we have taken one-period interest rates and Arrow security prices as exogenous objects determined outside the model\n",
"and specified them in ways designed to align our models closely with the consumption smoothing model of Barro [[Bar79](https://python-advanced.quantecon.org/zreferences.html#id136)].\n",
"\n",
"Other lectures make these objects endogenous and describe how a government optimally manipulates prices of government debt, albeit indirectly via effects distorting\n",
"taxes have on equilibrium prices and allocations.\n",
"\n",
"In [optimal taxation in an LQ economy](https://python-advanced.quantecon.org/lqramsey.html) and [recursive optimal taxation](https://python-advanced.quantecon.org/opt_tax_recur.html), we study **complete-markets**\n",
"models in which the government recognizes that it can manipulate Arrow securities prices.\n",
"\n",
"Linear-quadratic versions of the Lucas-Stokey tax-smoothing model are described in [Optimal Taxation in an LQ Economy](https://python-advanced.quantecon.org/lqramsey.html).\n",
"\n",
"That lecture is a warm-up for the non-linear-quadratic model of tax smoothing described in [Optimal Taxation with State-Contingent Debt](https://python-advanced.quantecon.org/opt_tax_recur.html).\n",
"\n",
"In both [Optimal Taxation in an LQ Economy](https://python-advanced.quantecon.org/lqramsey.html) and [Optimal Taxation with State-Contingent Debt](https://python-advanced.quantecon.org/opt_tax_recur.html), the government recognizes that its decisions affect prices.\n",
"\n",
"In [optimal taxation with incomplete markets](https://python-advanced.quantecon.org/amss.html), we study an **incomplete-markets** model in which the\n",
"government also manipulates prices of government debt."
]
}
],
"metadata": {
"date": 1672634195.8937871,
"filename": "smoothing_tax.md",
"kernelspec": {
"display_name": "Python",
"language": "python3",
"name": "python3"
},
"title": "Tax Smoothing with Complete and Incomplete Markets"
},
"nbformat": 4,
"nbformat_minor": 5
}