{
"cells": [
{
"cell_type": "markdown",
"id": "f95ad566",
"metadata": {},
"source": [
"\n",
""
]
},
{
"cell_type": "markdown",
"id": "26472933",
"metadata": {},
"source": [
"# Information and Consumption Smoothing\n",
"\n",
"In addition to what’s in Anaconda, this lecture employs the following libraries:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "895e7fef",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"!pip install --upgrade quantecon"
]
},
{
"cell_type": "markdown",
"id": "a4e785a9",
"metadata": {},
"source": [
"## Overview\n",
"\n",
"In the linear-quadratic\n",
"permanent income of consumption smoothing model described in this\n",
"[quantecon lecture](https://python-intro.quantecon.org/perm_income_cons.html),\n",
"a scalar parameter $ \\beta \\in (0,1) $ plays two roles:\n",
"\n",
"- it is a **discount factor** that the consumer applies to future utilities from consumption \n",
"- it is the reciprocal of the gross **interest rate** on risk-free one-period loans \n",
"\n",
"\n",
"That $ \\beta $ plays these two roles is essential in delivering the outcome that, **regardless**\n",
"of the stochastic process that describes his\n",
"non-financial income, the consumer chooses\n",
"to make consumption follow a random walk (see [[Hall, 1978](https://python-advanced.quantecon.org/zreferences.html#id153)]).\n",
"\n",
"In this lecture, we assign a third role to $ \\beta $:\n",
"\n",
"- it describes a **first-order moving average** process for the growth in non-financial income "
]
},
{
"cell_type": "markdown",
"id": "760afc61",
"metadata": {},
"source": [
"### Same non-financial incomes, different information\n",
"\n",
"We study two consumers who have exactly the same\n",
"nonfinancial income process and who both conform to the linear-quadratic\n",
"permanent income of consumption smoothing model described\n",
"[here](https://python-intro.quantecon.org/perm_income_cons.html).\n",
"\n",
"The two consumers have different information about their\n",
"future nonfinancial incomes.\n",
"\n",
"A better informed consumer each period receives **news** in the form of a shock that simultaneously\n",
"affects both **today’s** nonfinancial income and the\n",
"present value of **future** nonfinancial incomes in a particular way.\n",
"\n",
"A less informed consumer each period receives a shock\n",
"that equals the part of today’s nonfinancial income that could not be\n",
"forecast from past values of nonfinancial income.\n",
"\n",
"Even though they receive exactly the same nonfinancial incomes each\n",
"period, our two consumers behave differently because they have different information about\n",
"their future nonfinancial incomes.\n",
"\n",
"The second consumer receives less information about future nonfinancial\n",
"incomes in a sense that we shall make precise.\n",
"\n",
"This difference in their information sets manifests itself in their responding differently to what they regard as time $ t $ **information shocks**.\n",
"\n",
"Thus, although at each date they receive exactly the same histories of\n",
"nonfinancial income, our two consumers receive different **shocks** or **news** about\n",
"their **future** nonfinancial incomes.\n",
"\n",
"We use the different behaviors of our consumers as a way to learn about\n",
"\n",
"- operating characteristics of a linear-quadratic permanent income\n",
" model \n",
"- how the Kalman filter introduced in [this lecture](https://python-intro.quantecon.org/kalman.html)\n",
" and/or another representation of the theory of optimal\n",
" forecasting introduced in [this lecture](https://python-advanced.quantecon.org/classical_filtering.html)\n",
" embody lessons\n",
" that can be applied to the **news** and **noise** literature \n",
"- ways of representing and computing optimal decision rules in\n",
" the linear-quadratic permanent income model \n",
"- a **Ricardian equivalence** outcome that describes effects on optimal\n",
" consumption of a tax cut at time $ t $ accompanied by a foreseen\n",
" permanent increases in taxes that is just sufficient to cover the interest\n",
" payments used to service the risk-free government bonds that are issued to finance\n",
" the tax cut \n",
"- a simple application of alternative ways to factor a covariance\n",
" generating function along lines described in [this lecture](https://python-advanced.quantecon.org/classical_filtering.html) \n",
"\n",
"\n",
"This lecture can be regarded as an introduction to **invertibility** issues that take center stage in\n",
"the analysis of **fiscal foresight** by Eric Leeper, Todd Walker, and Susan Yang [[Leeper *et al.*, 2013](https://python-advanced.quantecon.org/zreferences.html#id34)], as well\n",
"as in chapter 4 of [[Sargent *et al.*, 1991](https://python-advanced.quantecon.org/zreferences.html#id59)]."
]
},
{
"cell_type": "markdown",
"id": "d85e636a",
"metadata": {},
"source": [
"## Two Representations of One Nonfinancial Income Process\n",
"\n",
"We study consequences of endowing a\n",
"consumer with one of two alternative representations for the change\n",
"in the consumer’s nonfinancial income $ y_{t+1} - y_t $.\n",
"\n",
"For both types of consumer, a parameter $ \\beta \\in (0,1) $ plays three roles.\n",
"\n",
"It appears\n",
"\n",
"- as a **discount factor** applied to future expected one-period utilities, \n",
"- as the **reciprocal of a gross interest rate** on one-period loans, and \n",
"- as a parameter in a first-order moving average that equals the increment in a consumer’s non-financial income \n",
"\n",
"\n",
"The first representation, which we shall sometimes refer to as the **more informative representation**, is\n",
"\n",
"\n",
"\n",
"$$\n",
"y_{t+1} - y_t = \\epsilon_{t+1} - \\beta^{-1} \\epsilon_t \\tag{5.1}\n",
"$$\n",
"\n",
"where $ \\{\\epsilon_t\\} $ is an i.i.d. normally distributed scalar\n",
"process with means of zero and contemporaneous variances\n",
"$ \\sigma_\\epsilon^2 $.\n",
"\n",
"This representation of the process is used by a consumer who at time\n",
"$ t $ knows both $ y_t $ and the shock\n",
"$ \\epsilon_t $ and can use both of them to forecast future\n",
"$ y_{t+j} $’s.\n",
"\n",
"As we’ll see below, representation [(5.1)](#equation-eqn-1) has the peculiar property that a positive shock\n",
"$ \\epsilon_{t+1} $ leaves the discounted present value of the consumer’s financial income at time $ t+1 $\n",
"unaltered.\n",
"\n",
"The second representation of the **same** $ \\{y_t\\} $ process is\n",
"\n",
"\n",
"\n",
"$$\n",
"y_{t+1} - y_t = a_{t+1} - \\beta a_t \\tag{5.2}\n",
"$$\n",
"\n",
"where $ \\{a_t\\} $ is another i.i.d. normally distributed scalar\n",
"process, with means of zero and now variances $ \\sigma_a^2 > \\sigma_\\epsilon^2 $.\n",
"\n",
"The i.i.d. shock variances are related by\n",
"\n",
"$$\n",
"\\sigma_a^2 = \\beta^{-2} \\sigma_\\epsilon^2 > \\sigma_\\epsilon^2\n",
"$$\n",
"\n",
"so that the variance of the innovation exceeds the variance of the\n",
"original shock by a multiplicative factor $ \\beta^{-2} $.\n",
"\n",
"Representation [(5.2)](#equation-eqn-2) is the **innovations representation** of equation [(5.1)](#equation-eqn-1) associated with\n",
"Kalman filtering theory.\n",
"\n",
"To see how this works, note that equating representations [(5.1)](#equation-eqn-1)\n",
"and [(5.2)](#equation-eqn-2) for $ y_{t+1} - y_t $ implies\n",
"$ \\epsilon_{t+1} - \\beta^{-1} \\epsilon_t = a_{t+1} - \\beta a_t $,\n",
"which in turn implies\n",
"\n",
"$$\n",
"a_{t+1} = \\beta a_t + \\epsilon_{t+1} - \\beta^{-1} \\epsilon_t .\n",
"$$\n",
"\n",
"Solving this difference equation backwards for $ a_{t+1} $ gives,\n",
"after a few lines of algebra,\n",
"\n",
"\n",
"\n",
"$$\n",
"a_{t+1} = \\epsilon_{t+1} + (\\beta - \\beta^{-1}) \\sum_{j=0}^\\infty \\beta^j \\epsilon_{t-j} \\quad \\tag{5.3}\n",
"$$\n",
"\n",
"which we can also write as\n",
"\n",
"$$\n",
"a_{t+1} = \\sum_{j=0}^\\infty h_j \\epsilon_{t+1 -j} \\equiv h(L) \\epsilon_{t+1}\n",
"$$\n",
"\n",
"where $ L $ is the one-period lag operator, $ h(L) = \\sum_{j=0}^\\infty h_j L^j $, $ I $ is the\n",
"identity operator, and\n",
"\n",
"$$\n",
"h(L) = \\frac{ I -\\beta^{-1} L}{ I - \\beta L}\n",
"$$\n",
"\n",
"Let $ g_j \\equiv E z_t z_{t-j} $ be the $ j $th autocovariance\n",
"of the $ \\{y_t - y_{t-1}\\} $ process.\n",
"\n",
"Using calculations in the [quantecon lecture](https://python-advanced.quantecon.org/classical_filtering.html), where\n",
"$ z \\in C $ is a complex variable, the **covariance generating\n",
"function** $ g (z) =\n",
"\\sum_{j=-\\infty}^\\infty g_j z^j $\n",
"of the $ \\{y_t - y_{t-1}\\} $ process equals\n",
"\n",
"$$\n",
"g(z) = \\sigma_\\epsilon^2 h(z) h(z^{-1}) = \\beta^{-2} \\sigma_\\epsilon^2 > \\sigma_\\epsilon^2 ,\n",
"$$\n",
"\n",
"which confirms that $ \\{a_t\\} $ is a **serially uncorrelated**\n",
"process with variance\n",
"\n",
"$$\n",
"\\sigma_a^2 = \\beta^{-1} \\sigma_\\epsilon^2 .\n",
"$$\n",
"\n",
"To verify these claims, just notice that\n",
"$ g(z) = \\beta^{-2} \\sigma_\\epsilon^2 $ implies that\n",
"\n",
"- $ g_0 = \\beta^{-2} \\sigma_\\epsilon^2 $, and \n",
"- $ g_j = 0 $ for $ j \\neq 0 $. \n",
"\n",
"\n",
"Alternatively, if you are uncomfortable with covariance generating\n",
"functions, note that we can directly calculate $ \\sigma_a^2 $ from\n",
"formula [(5.3)](#equation-eqn-3) according to\n",
"\n",
"$$\n",
"\\sigma_a^2 = \\sigma_\\epsilon^2 + [ 1 + (\\beta - \\beta^{-1})^2 \\sum_{j=0}^\\infty \\beta^{2j} ] = \\beta^{-1} \\sigma_\\epsilon^2 .\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "f6fc6579",
"metadata": {},
"source": [
"## Application of Kalman filter\n",
"\n",
"We can also use the the **Kalman filter** to obtain representation [(5.2)](#equation-eqn-2) from representation [(5.1)](#equation-eqn-1).\n",
"\n",
"Thus, from equations associated with the **Kalman filter**, it can be\n",
"verified that the steady-state Kalman gain $ K = \\beta^2 $ and the\n",
"steady state conditional covariance\n",
"\n",
"$$\n",
"\\Sigma = E [(\\epsilon_t - \\hat \\epsilon_t)^2 | y_{t-1}, y_{t-2}, \\ldots ] = (1 - \\beta^2) \\sigma_\\epsilon^2\n",
"$$\n",
"\n",
"In a little more detail, let $ z_t = y_t - y_{t-1} $ and form the\n",
"state-space representation\n",
"\n",
"$$\n",
"\\begin{aligned} \\epsilon_{t+1} & = 0 \\epsilon_t + \\epsilon_{t+1} \\cr\n",
" z_{t+1} & = - \\beta^{-1} \\epsilon_t + \\epsilon_{t+1} \\end{aligned}\n",
"$$\n",
"\n",
"and assume that $ \\sigma_\\epsilon = 1 $ for convenience\n",
"\n",
"Let’s compute the steady-state Kalman filter for this system.\n",
"\n",
"Let $ K $\n",
"be the steady-state gain and $ a_{t+1} $ the one-step ahead\n",
"innovation.\n",
"\n",
"The steady-state innovations representation is\n",
"\n",
"$$\n",
"\\begin{aligned} \\hat \\epsilon_{t+1} & = 0 \\hat \\epsilon_t + K a_{t+1} \\cr\n",
" z_{t+1} & = - \\beta a_t + a_{t+1} \\end{aligned}\n",
"$$\n",
"\n",
"By applying formulas for the steady-state Kalman filter, by hand it is possible to verify that\n",
"$ K = \\beta^2, \\sigma_a^2 = \\beta^{-2} \\sigma_\\epsilon^2 = \\beta^{-2}, $\n",
"and $ \\Sigma = (1-\\beta^2) \\sigma_\\epsilon^2 $.\n",
"\n",
"Alternatively, we can obtain these formulas via the classical filtering theory\n",
"described in [this lecture](https://python-advanced.quantecon.org/classical_filtering.html)."
]
},
{
"cell_type": "markdown",
"id": "ecac6a88",
"metadata": {},
"source": [
"## News Shocks and Less Informative Shocks\n",
"\n",
"Representation [(5.1)](#equation-eqn-1) is cast in terms of a **news shock**\n",
"$ \\epsilon_{t+1} $ that represents a shock to nonfinancial income\n",
"coming from taxes, transfers, and other random sources of income changes\n",
"known to a well-informed person who perhaps has all sorts of information about\n",
"the income process.\n",
"\n",
"Representation [(5.2)](#equation-eqn-2) for the **same** income process is driven by shocks\n",
"$ a_t $ that contain less information than the news shock\n",
"$ \\epsilon_t $.\n",
"\n",
"Representation [(5.2)](#equation-eqn-2) is called the **innovations** representation for the\n",
"$ \\{y_t - y_{t-1}\\} $ process.\n",
"\n",
"It is cast in terms of what time series statisticians call the\n",
"**innovation** or **fundamental** shock that emerges from applying the\n",
"theory of optimally predicting nonfinancial income based solely on the\n",
"information in **past** levels of growth in\n",
"nonfinancial income.\n",
"\n",
"**Fundamental for the** $ {y_t} $ **process** means that the shock\n",
"$ a_t $ can be expressed as a square-summable linear combination of\n",
"$ y_t, y_{t-1}, \\ldots $.\n",
"\n",
"The shock $ \\epsilon_t $ is **not fundamental** because it has more\n",
"information about the future of the $ \\{y_t - y_{t-1}\\} $ process\n",
"than is contained in $ a_t $.\n",
"\n",
"Representation [(5.3)](#equation-eqn-3) reveals the important fact that the **original\n",
"shock** $ \\epsilon_t $ contains more information about future\n",
"$ y $’s than is contained in the semi-infinite history\n",
"$ y^t = [y_t, y_{t-1}, \\ldots ] $.\n",
"\n",
"Staring at representation [(5.3)](#equation-eqn-3) for $ a_{t+1} $ shows that it consists\n",
"both of **new news** $ \\epsilon_{t+1} $ as well as a long moving\n",
"average $ (\\beta - \\beta^{-1})\\sum_{j=0}^\\infty \\beta^j\\epsilon_{t-j} $ of **old news**.\n",
"\n",
"The **more information** representation [(5.1)](#equation-eqn-1) asserts that a shock\n",
"$ \\epsilon_{t} $ results in an impulse response to nonfinancial\n",
"income of $ \\epsilon_t $ times the sequence\n",
"\n",
"$$\n",
"1, 1- \\beta^{-1}, 1- \\beta^{-1}, \\ldots\n",
"$$\n",
"\n",
"so that a shock that **increases** nonfinancial income $ y_t $ by\n",
"$ \\epsilon_t $ at time $ t $ is followed by a change in\n",
"future $ y $ of $ \\epsilon_t $ times $ 1 - \\beta^{-1} < 0 $\n",
"in **all** subsequent periods.\n",
"\n",
"Because $ 1 - \\beta^{-1} < 0 $, this means that a positive shock of\n",
"$ \\epsilon_t $ today raises income at time $ t $ by\n",
"$ \\epsilon_t $ and then permanently **decreases all** future incomes by\n",
"$ (\\beta^{-1} -1)\\epsilon_t $.\n",
"\n",
"This pattern precisely describes the following mental experiment:\n",
"\n",
"- The consumer receives a government transfer of $ \\epsilon_t $ at\n",
" time $ t $. \n",
"- The government finances the transfer by issuing a one-period bond on\n",
" which it pays a gross one-period risk-free interest rate equal to\n",
" $ \\beta^{-1} $. \n",
"- In each future period, the government **rolls over** the one-period\n",
" bond and so continues to borrow $ \\epsilon_t $ forever. \n",
"- The government imposes a lump-sum tax on the consumer in order to pay\n",
" just the current interest on the original bond and its rolled over successors. \n",
"- Thus, in periods $ t+1, t+2, \\ldots $, the government levies\n",
" a lump-sum tax on the consumer of $ \\beta^{-1} -1 $ that is just\n",
" enough to pay the interest on the bond. \n",
"\n",
"\n",
"The **present value** of the impulse response or moving average\n",
"coefficients equals $ d_\\epsilon(L) = \\frac{0}{1 -\\beta } =0 $, a fact that we’ll see again\n",
"below.\n",
"\n",
"Representation [(5.2)](#equation-eqn-2), i.e., the innovations representation, asserts that a\n",
"shock $ a_{t} $ results in an impulse response to nonfinancial\n",
"income of $ a_t $ times\n",
"\n",
"$$\n",
"1, 1 -\\beta, 1 - \\beta, \\ldots\n",
"$$\n",
"\n",
"so that a shock that increases income $ y_t $ by $ a_t $ at time\n",
"$ t $ can be expected to be followed by an **increase** in $ y_{t+j} $\n",
"of $ a_t $ times $ 1 - \\beta > 0 $ in all future periods $ j=1, 2, \\ldots $.\n",
"\n",
"The present value of the impulse response or moving average coefficients\n",
"for representation [(5.2)](#equation-eqn-2) is\n",
"$ d_a(\\beta) = \\frac{1 -\\beta^2}{1 -\\beta } = (1 + \\beta) $, another\n",
"fact that will be important below."
]
},
{
"cell_type": "markdown",
"id": "1a6fa2d0",
"metadata": {},
"source": [
"## Representation of $ \\epsilon_t $ Shock in Terms of Future $ y_t $\n",
"\n",
"Notice that reprentation [(5.1)](#equation-eqn-1), namely, $ y_{t+1} - y_t = -\\beta^{-1} \\epsilon_t + \\epsilon_{t+1} $\n",
"implies the linear difference equation\n",
"\n",
"$$\n",
"\\epsilon_t = \\beta \\epsilon_{t+1} - \\beta (y_{t+1} - y_t ).\n",
"$$\n",
"\n",
"Solving forward we obtain\n",
"\n",
"$$\n",
"\\epsilon_t = \\beta ( y_t - (1-\\beta) \\sum_{j=0}^\\infty \\beta^j y_{t+j+ 1} )\n",
"$$\n",
"\n",
"This equation shows that $ \\epsilon_t $ equals\n",
"$ \\beta $ times the one-step-backwards error in\n",
"optimally **backcasting** $ y_t $ based on\n",
"the semi-infinite **future** $ y^t_+ \\equiv [y_{t+1}, y_{t+2}, \\ldots ] $ via the **optimal backcasting formula**\n",
"\n",
"$$\n",
"E [ y_t | y^t_+] = (1-\\beta) \\sum_{j=0}^\\infty \\beta^j y_{t+j+ 1}\n",
"$$\n",
"\n",
"Thus, $ \\epsilon_t $ **exactly** reveals the gap between $ y_t $ and $ E [ y_t | y^t_+] $."
]
},
{
"cell_type": "markdown",
"id": "3a4df73d",
"metadata": {},
"source": [
"## Representation in Terms of $ a_t $ Shocks\n",
"\n",
"Next notice that representation [(5.2)](#equation-eqn-2), namely, $ y_{t+1} - y_t = -\n",
"\\beta a_t + a_{t+1} $ implies the linear difference\n",
"equation\n",
"\n",
"$$\n",
"a_{t+1} = \\beta a_t + (y_{t+1} - y_t)\n",
"$$\n",
"\n",
"Solving this equation backward establishes that the one-step-prediction\n",
"error $ a_{t+1} $ is\n",
"\n",
"$$\n",
"a_{t+1} = y_{t+1} - (1-\\beta) \\sum_{j=0}^\\infty \\beta^j y_{t-j} .\n",
"$$\n",
"\n",
"Here the information set is $ y^t = [y_t, y_{t-1}, \\ldots ] $ and a one step-ahead optimal prediction is\n",
"\n",
"$$\n",
"E [ y_{t+1} | y^t ] = (1-\\beta) \\sum_{j=0}^\\infty \\beta^j y_{t-j}\n",
"$$"
]
},
{
"cell_type": "markdown",
"id": "f3f3c832",
"metadata": {},
"source": [
"## Permanent Income Consumption-Smoothing Model\n",
"\n",
"When we computed optimal consumption-saving policies for our two\n",
"representations [(5.1)](#equation-eqn-1) and [(5.2)](#equation-eqn-2) by using formulas obtained with the difference equation\n",
"approach described in [quantecon lecture](https://python-intro.quantecon.org/perm_income_cons.html),\n",
"we obtained:\n",
"\n",
"**for a consumer having the information assumed in the news\n",
"representation** [(5.1)](#equation-eqn-1):\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"c_{t+1} - c_t & = 0 \\cr\n",
"b_{t+1} - b_t & = - \\beta^{-1} \\epsilon_t\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"**for a consumer having the more limited information associated with the\n",
"innovations representation** [(5.2)](#equation-eqn-2):\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"c_{t+1} - c_t & = (1-\\beta^2) a_{t+1} \\cr\n",
"b_{t+1} - b_t & = - \\beta a_t\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"These formulas agree with outcomes from Python programs below that deploy state-space representations and dynamic\n",
"programming.\n",
"\n",
"Evidently, although they receive\n",
"exactly the same histories of nonfinancial incomethe two consumers behave differently.\n",
"\n",
"The better informed consumer who has the information sets associated with representation [(5.1)](#equation-eqn-1)\n",
"responds to each shock $ \\epsilon_{t+1} $ by leaving his consumption\n",
"unaltered and **saving** all of $ \\epsilon_{t+1} $ in anticipation of the\n",
"permanently increased taxes that he will bear in order to service the permanent interest payments on the risk-free\n",
"bonds that the government has\n",
"presumably issued to pay for the one-time addition\n",
"$ \\epsilon_{t+1} $ to his time $ t+1 $ nonfinancial income.\n",
"\n",
"The less well informed consumer who has information sets associated with representation [(5.2)](#equation-eqn-2)\n",
"responds to a shock $ a_{t+1} $ by increasing his consumption by\n",
"what he perceives to be the **permanent** part of the increase in\n",
"consumption and by increasing his **saving** by what he perceives to be\n",
"the temporary part.\n",
"\n",
"The behavior of the better informed consumer sharply illustrates the behavior predicted in a classic\n",
"Ricardian equivalence experiment."
]
},
{
"cell_type": "markdown",
"id": "43173472",
"metadata": {},
"source": [
"## State Space Representations\n",
"\n",
"We now cast our representations [(5.1)](#equation-eqn-1) and [(5.2)](#equation-eqn-2), respectively, in terms of the following two state\n",
"space systems:\n",
"\n",
"\n",
"\n",
"$$\n",
"\\begin{aligned} \\begin{bmatrix} y_{t+1} \\cr \\epsilon_{t+1} \\end{bmatrix} &=\n",
" \\begin{bmatrix} 1 & - \\beta^{-1} \\cr 0 & 0 \\end{bmatrix} \\begin{bmatrix} y_t \\cr \\epsilon_t \\end{bmatrix}\n",
" + \\begin{bmatrix} \\sigma_\\epsilon \\cr \\sigma_\\epsilon \\end{bmatrix}\n",
" v_{t+1} \\cr\n",
"y_t & = \\begin{bmatrix} 1 & 0 \\end{bmatrix} \\begin{bmatrix} y_t \\cr \\epsilon_t \\end{bmatrix} \\end{aligned} \\tag{5.4}\n",
"$$\n",
"\n",
"and\n",
"\n",
"\n",
"\n",
"$$\n",
"\\begin{aligned} \\begin{bmatrix} y_{t+1} \\cr a_{t+1} \\end{bmatrix} &=\n",
" \\begin{bmatrix} 1 & - \\beta \\cr 0 & 0 \\end{bmatrix} \\begin{bmatrix} y_t \\cr a_t \\end{bmatrix}\n",
" + \\begin{bmatrix} \\sigma_a \\cr \\sigma_a \\end{bmatrix}\n",
" u_{t+1} \\cr\n",
"y_t & = \\begin{bmatrix} 1 & 0 \\end{bmatrix} \\begin{bmatrix} y_t \\cr a_t \\end{bmatrix} \\end{aligned} \\tag{5.5}\n",
"$$\n",
"\n",
"where $ \\{v_t\\} $ and $ \\{u_t\\} $ are both i.i.d. sequences of\n",
"univariate standardized normal random variables.\n",
"\n",
"These two alternative income processes are ready to be used in the\n",
"framework presented in the section “Comparison with the Difference\n",
"Equation Approach” in thid [quantecon lecture](https://python-intro.quantecon.org/perm_income_cons.html).\n",
"\n",
"All the code that we shall use below is presented in that lecture."
]
},
{
"cell_type": "markdown",
"id": "8a32ba49",
"metadata": {},
"source": [
"## Computations\n",
"\n",
"We shall use Python to form two state-space\n",
"representations [(5.4)](#equation-eqstsp1) and [(5.5)](#equation-eqstsp2).\n",
"\n",
"We set the following parameter values\n",
"$ \\sigma_\\epsilon = 1, \\sigma_a = \\beta^{-1} \\sigma_\\epsilon = \\beta^{-1} $\n",
"where $ \\beta $ is the **same** value as the discount factor in the\n",
"household’s problem in the LQ savings problem in the [lecture](https://python-intro.quantecon.org/perm_income_cons.html).\n",
"\n",
"For these two representations, we use the code in this\n",
"[lecture](https://python-intro.quantecon.org/perm_income_cons.html) to\n",
"\n",
"- compute optimal decision rules for $ c_t, b_t $ for the two types\n",
" of consumers associated with our two representations of nonfinancial\n",
" income \n",
"- use the value function objects $ P, d $ returned by the code to\n",
" compute optimal values for the two representations when evaluated at\n",
" the initial condition \n",
"\n",
"\n",
"$$\n",
"x_0 = \\begin{bmatrix} 10 \\cr 0 \\end{bmatrix}\n",
"$$\n",
"\n",
"for each representation.\n",
"\n",
"- create instances of the\n",
" [LinearStateSpace](https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/lss.py)\n",
" class for the two representations of the $ \\{y_t\\} $ process and\n",
" use them to obtain impulse response functions of $ c_t $ and\n",
" $ b_t $ to the respective shocks $ \\epsilon_t $ and\n",
" $ a_t $ for the two representations. \n",
"- run simulations of $ \\{y_t, c_t, b_t\\} $ of length $ T $\n",
" under both of the representations \n",
"\n",
"\n",
"We formulae the problem:\n",
"\n",
"$$\n",
"\\min\\ \\sum_{t=0}^{\\infty}\\beta^{t}\\left(c_{t}-\\gamma\\right)^{2}\n",
"$$\n",
"\n",
"subject to a sequence of constraints\n",
"\n",
"$$\n",
"\\quad c_{t}+b_{t}=\\frac{1}{1+r}b_{t+1}+y_{t}, \\quad t \\geq 0\n",
"$$\n",
"\n",
"where $ y_t $ follows one of the representations defined above.\n",
"\n",
"Define the control as $ u_t \\equiv c_t - \\gamma $.\n",
"\n",
"(For simplicity we can assume $ \\gamma=0 $ below because\n",
"$ \\gamma $ has no effect on the impulse response functions that\n",
"interest us.)\n",
"\n",
"The state transition equations under our two representations for the\n",
"nonfinancial income process $ \\{y_t\\} $ can be written as\n",
"\n",
"$$\n",
"\\left[\\begin{array}{c}\n",
"y_{t+1}\\\\\n",
"\\epsilon_{t+1}\\\\\n",
"b_{t+1}\n",
"\\end{array}\\right]=\\underset{\\equiv A_{1}}{\\underbrace{\\left[\\begin{array}{ccc}\n",
"1 & -\\beta^{-1} & 0\\\\\n",
"0 & 0 & 0\\\\\n",
"-\\left(1+r\\right) & 0 & 1+r\n",
"\\end{array}\\right]}}\\left[\\begin{array}{c}\n",
"y_{t}\\\\\n",
"\\epsilon_{t}\\\\\n",
"b_{t}\n",
"\\end{array}\\right]+\\underset{\\equiv B_{1}}{\\underbrace{\\left[\\begin{array}{c}\n",
"0\\\\\n",
"0\\\\\n",
"1+r\n",
"\\end{array}\\right]}}\\left[\\begin{array}{c}\n",
"c_{t}\\end{array}\\right]+\\underset{\\equiv C_{1}}{\\underbrace{\\left[\\begin{array}{c}\n",
"\\sigma_{\\epsilon}\\\\\n",
"\\sigma_{\\epsilon}\\\\\n",
"0\n",
"\\end{array}\\right]}}\\nu_{t+1},\n",
"$$\n",
"\n",
"and\n",
"\n",
"$$\n",
"\\left[\\begin{array}{c}\n",
"y_{t+1}\\\\\n",
"a_{t+1}\\\\\n",
"b_{t+1}\n",
"\\end{array}\\right]=\\underset{\\equiv A_{2}}{\\underbrace{\\left[\\begin{array}{ccc}\n",
"1 & -\\beta & 0\\\\\n",
"0 & 0 & 0\\\\\n",
"-\\left(1+r\\right) & 0 & 1+r\n",
"\\end{array}\\right]}}\\left[\\begin{array}{c}\n",
"y_{t}\\\\\n",
"a_{t}\\\\\n",
"b_{t}\n",
"\\end{array}\\right]+\\underset{\\equiv B_{2}}{\\underbrace{\\left[\\begin{array}{c}\n",
"0\\\\\n",
"0\\\\\n",
"1+r\n",
"\\end{array}\\right]}}\\left[\\begin{array}{c}\n",
"c_{t}\\end{array}\\right]+\\underset{\\equiv C_{2}}{\\underbrace{\\left[\\begin{array}{c}\n",
"\\sigma_{a}\\\\\n",
"\\sigma_{a}\\\\\n",
"0\n",
"\\end{array}\\right]}}u_{t+1}.\n",
"$$\n",
"\n",
"As usual, we start by importing packages."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f0601d7e",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"import numpy as np\n",
"import quantecon as qe\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "74cb607b",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# Set parameters\n",
"β, σϵ = 0.95, 1\n",
"σa = σϵ / β\n",
"\n",
"R = 1 / β\n",
"\n",
"# Payoff matrices are the same for two representations\n",
"RLQ = np.array([[0, 0, 0],\n",
" [0, 0, 0],\n",
" [0, 0, 1e-12]]) # put penalty on debt\n",
"QLQ = np.array([1.])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "377f2d83",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# More informative representation state transition matrices\n",
"ALQ1 = np.array([[1, -R, 0],\n",
" [0, 0, 0],\n",
" [-R, 0, R]])\n",
"BLQ1 = np.array([[0, 0, R]]).T\n",
"CLQ1 = np.array([[σϵ, σϵ, 0]]).T\n",
"\n",
"# Construct and solve the LQ problem\n",
"LQ1 = qe.LQ(QLQ, RLQ, ALQ1, BLQ1, C=CLQ1, beta=β)\n",
"P1, F1, d1 = LQ1.stationary_values()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "73525c55",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# The optimal decision rule for c\n",
"-F1"
]
},
{
"cell_type": "markdown",
"id": "69b852dd",
"metadata": {},
"source": [
"Evidently, optimal consumption and debt decision rules for the consumer\n",
"having news representation [(5.1)](#equation-eqn-1) are\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"c_{t}^{*} &= y_{t}-\\epsilon_{t}-\\left(1-\\beta\\right)b_{t}, \\\\\n",
"b_{t+1}^{*} &=\\beta^{-1}c_{t}^{*}+\\beta^{-1}b_{t}-\\beta^{-1}y_{t} \\\\\n",
" & =\\beta^{-1}y_{t}-\\beta^{-1}\\epsilon_{t}-\\left(\\beta^{-1}-1\\right)b_{t}+\\beta^{-1}b_{t}-\\beta^{-1}y_{t} \\\\\n",
" & =b_{t}-\\beta^{-1}\\epsilon_{t}.\n",
"\\end{aligned}\n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8031c088",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# Innovations representation\n",
"ALQ2 = np.array([[1, -β, 0],\n",
" [0, 0, 0],\n",
" [-R, 0, R]])\n",
"BLQ2 = np.array([[0, 0, R]]).T\n",
"CLQ2 = np.array([[σa, σa, 0]]).T\n",
"\n",
"LQ2 = qe.LQ(QLQ, RLQ, ALQ2, BLQ2, C=CLQ2, beta=β)\n",
"P2, F2, d2 = LQ2.stationary_values()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "12831f10",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"-F2"
]
},
{
"cell_type": "markdown",
"id": "c93b3ae0",
"metadata": {},
"source": [
"For a consumer having access only to the information associated with the\n",
"innovations representation [(5.2)](#equation-eqn-2), the optimal decision rules are\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"c_{t}^{*} &= y_{t}-\\beta^{2}a_{t}-\\left(1-\\beta\\right)b_{t}, \\\\\n",
"b_{t+1}^{*} &= \\beta^{-1}c_{t}^{*}+\\beta^{-1}b_{t}-\\beta^{-1}y_{t} \\\\\n",
" &=\\beta^{-1}y_{t}-\\beta a_{t}-\\left(\\beta^{-1}-1\\right)b_{t}+\\beta^{-1}b_{t}-\\beta^{-1}y_{t} \\\\\n",
" &=b_{t}-\\beta a_{t}.\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"Now we construct two Linear State Space models that emerge from using\n",
"optimal policies of the form $ u_t =- F x_t $.\n",
"\n",
"Take the more informative original representation [(5.1)](#equation-eqn-1) as an example:\n",
"\n",
"$$\n",
"\\left[\\begin{array}{c}\n",
"y_{t+1}\\\\\n",
"\\epsilon_{t+1}\\\\\n",
"b_{t+1}\n",
"\\end{array}\\right]=\\left(A_{1}-B_{1}F_{1}\\right)\\left[\\begin{array}{c}\n",
"y_{t}\\\\\n",
"\\epsilon_{t}\\\\\n",
"b_{t}\n",
"\\end{array}\\right]+C_{1}\\nu_{t+1}\n",
"$$\n",
"\n",
"$$\n",
"\\left[\\begin{array}{c}\n",
"c_{t}\\\\\n",
"b_{t}\n",
"\\end{array}\\right]=\\left[\\begin{array}{c}\n",
"-F_{1}\\\\\n",
"S_{b}\n",
"\\end{array}\\right]\\left[\\begin{array}{c}\n",
"y_{t}\\\\\n",
"\\epsilon_{t}\\\\\n",
"b_{t}\n",
"\\end{array}\\right]\n",
"$$\n",
"\n",
"To have the Linear State Space model be of an innovations representation\n",
"form [(5.2)](#equation-eqn-2), we can simply replace the corresponding matrices."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "eb6e9d95",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# Construct two Linear State Space models\n",
"Sb = np.array([0, 0, 1])\n",
"\n",
"ABF1 = ALQ1 - BLQ1 @ F1\n",
"G1 = np.vstack([-F1, Sb])\n",
"LSS1 = qe.LinearStateSpace(ABF1, CLQ1, G1)\n",
"\n",
"ABF2 = ALQ2 - BLQ2 @ F2\n",
"G2 = np.vstack([-F2, Sb])\n",
"LSS2 = qe.LinearStateSpace(ABF2, CLQ2, G2)"
]
},
{
"cell_type": "markdown",
"id": "7a328db2",
"metadata": {},
"source": [
"The following code computes impulse response functions of\n",
"$ c_t $ and $ b_t $."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "445daaa0",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"J = 5 # Number of coefficients that we want\n",
"\n",
"x_res1, y_res1 = LSS1.impulse_response(j=J)\n",
"b_res1 = np.array([x_res1[i][2, 0] for i in range(J)])\n",
"c_res1 = np.array([y_res1[i][0, 0] for i in range(J)])\n",
"\n",
"x_res2, y_res2 = LSS2.impulse_response(j=J)\n",
"b_res2 = np.array([x_res2[i][2, 0] for i in range(J)])\n",
"c_res2 = np.array([y_res2[i][0, 0] for i in range(J)])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b7491bfe",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"c_res1 / σϵ, b_res1 / σϵ"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "36d33824",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"plt.title(\"more informative representation\")\n",
"plt.plot(range(J), c_res1 / σϵ, label=\"c impulse response function\")\n",
"plt.plot(range(J), b_res1 / σϵ, label=\"b impulse response function\")\n",
"plt.legend()"
]
},
{
"cell_type": "markdown",
"id": "2ff21b6b",
"metadata": {},
"source": [
"The above two impulse response functions show that when the consumer has\n",
"the information assumed in the more informative representation [(5.1)](#equation-eqn-1), his response to\n",
"receiving a positive shock of $ \\epsilon_t $ is to leave his\n",
"consumption unchanged and to save the entire amount of his extra income\n",
"and then forever roll over the extra bonds that he holds.\n",
"\n",
"To see this notice, that starting from next period on, his debt\n",
"permanently **decreases** by $ \\beta^{-1} $"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8d0b621c",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"c_res2 / σa, b_res2 / σa"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a6654fb2",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"plt.title(\"innovations representation\")\n",
"plt.plot(range(J), c_res2 / σa, label=\"c impulse response function\")\n",
"plt.plot(range(J), b_res2 / σa, label=\"b impulse response function\")\n",
"plt.plot([0, J-1], [0, 0], '--', color='k')\n",
"plt.legend()"
]
},
{
"cell_type": "markdown",
"id": "8ef131d6",
"metadata": {},
"source": [
"The above impulse responses show that when the consumer has only the\n",
"information that is assumed to be available under the innovations\n",
"representation [(5.2)](#equation-eqn-2) for $ \\{y_t - y_{t-1} \\} $, he responds to a positive\n",
"$ a_t $ by **permanently** increasing his consumption.\n",
"\n",
"He accomplishes this by consuming a fraction $ (1 - \\beta^2) $ of\n",
"the increment $ a_t $ to his nonfinancial income and saving the rest, thereby\n",
"lowering $ b_{t+1} $ in order to finance the permanent increment in\n",
"his consumption.\n",
"\n",
"The preceding computations confirm what we had derived earlier using\n",
"paper and pencil.\n",
"\n",
"Now let’s simulate some paths of consumption and debt for our two types\n",
"of consumers while always presenting both types with the same\n",
"$ \\{y_t\\} $ path."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8dd448ae",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# Set time length for simulation\n",
"T = 100"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a5547c62",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"x1, y1 = LSS1.simulate(ts_length=T)\n",
"plt.plot(range(T), y1[0, :], label=\"c\")\n",
"plt.plot(range(T), x1[2, :], label=\"b\")\n",
"plt.plot(range(T), x1[0, :], label=\"y\")\n",
"plt.title(\"more informative representation\")\n",
"plt.legend()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ebbffb5e",
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"x2, y2 = LSS2.simulate(ts_length=T)\n",
"plt.plot(range(T), y2[0, :], label=\"c\")\n",
"plt.plot(range(T), x2[2, :], label=\"b\")\n",
"plt.plot(range(T), x2[0, :], label=\"y\")\n",
"plt.title(\"innovations representation\")\n",
"plt.legend()"
]
},
{
"cell_type": "markdown",
"id": "0b87acda",
"metadata": {},
"source": [
"## Simulating Income Process and Two Associated Shock Processes\n",
"\n",
"We now form a **single** $ \\{y_t\\}_{t=0}^T $ realization\n",
"that we will use to simulate decisions associated\n",
"with our two types of consumer.\n",
"\n",
"We accomplish this in the following steps.\n",
"\n",
"1. We form a $ \\{y_t, \\epsilon_t\\} $ realization by drawing a long\n",
" simulation of $ \\{\\epsilon_t\\}_{t=0}^T $, where $ T $ is a big\n",
" integer, $ \\epsilon_t = \\sigma_\\epsilon v_t $, $ v_t $ is a\n",
" standard normal scalar, $ y_0 =100 $, and \n",
" $$\n",
" y_{t+1} - y_t =-\\beta^{-1} \\epsilon_t + \\epsilon_{t+1} .\n",
" $$\n",
"1. We take the $ \\{y_t\\} $ realization generated in step 1\n",
" and form an innovation process $ \\{a_t\\} $ from the formulas \n",
" $$\n",
" \\begin{aligned} a_0 & = 0 \\cr\n",
" a_t & = \\sum_{j=0}^{t-1} \\beta^j (y_{t-j} - y_{t-j-1}) + \\beta^t a_0, \\quad t \\geq 1 \\end{aligned}\n",
" $$\n",
"1. We throw away the first $ S $ observations and form a sample\n",
" $ \\{y_t, \\epsilon_t, a_t\\}_{S+1}^T $ as the realization that\n",
" we’ll use in the following steps. \n",
"1. We use the step 3 realization to **evaluate** and **simulate** the\n",
" decision rules for $ c_t, b_t $ that Python has computed for us\n",
" above. \n",
"\n",
"\n",
"The above steps implement the experiment of comparing decisions made by\n",
"two consumers having **identical** incomes at each date but at each date\n",
"having **different** information about their future incomes."
]
},
{
"cell_type": "markdown",
"id": "5b7bcd1e",
"metadata": {},
"source": [
"## Calculating Innovations in Another Way\n",
"\n",
"Here we use formula [(5.3)](#equation-eqn-3) above to compute $ a_{t+1} $ as a function\n",
"of the history\n",
"$ \\epsilon_{t+1}, \\epsilon_t, \\epsilon_{t-1}, \\ldots $\n",
"\n",
"Thus, we compute\n",
"\n",
"$$\n",
"\\begin{aligned}\n",
"a_{t+1} &=\\beta a_{t}+\\epsilon_{t+1}-\\beta^{-1}\\epsilon_{t} \\\\\n",
" &=\\beta\\left(\\beta a_{t-1}+\\epsilon_{t}-\\beta^{-1}\\epsilon_{t-1}\\right)+\\epsilon_{t+1}-\\beta^{-1}\\epsilon_{t} \\\\\n",
" &=\\beta^{2}a_{t-1}+\\beta\\left(\\epsilon_{t}-\\beta^{-1}\\epsilon_{t-1}\\right)+\\epsilon_{t+1}-\\beta^{-1}\\epsilon_{t} \\\\\n",
" &= \\quad \\quad \\quad \\quad \\vdots \\quad \\quad \\quad \\vdots \\\\\n",
" &=\\beta^{t+1}a_{0}+\\sum_{j=0}^{t}\\beta^{j}\\left(\\epsilon_{t+1-j}-\\beta^{-1}\\epsilon_{t-j}\\right) \\\\\n",
" &=\\beta^{t+1}a_{0}+\\epsilon_{t+1}+\\left(\\beta-\\beta^{-1}\\right)\\sum_{j=0}^{t-1}\\beta^{j}\\epsilon_{t-j}-\\beta^{t-1}\\epsilon_{0}.\n",
"\\end{aligned}\n",
"$$\n",
"\n",
"We can verify that we recover the same $ \\{a_t\\} $ sequence\n",
"computed earlier."
]
},
{
"cell_type": "markdown",
"id": "7b6de8d2",
"metadata": {},
"source": [
"## Another Invertibility Issue\n",
"\n",
"This [quantecon lecture](https://python-advanced.quantecon.org/hs_invertibility_example.html) contains another example of a shock-invertibility issue that is endemic\n",
"to the LQ permanent income or consumption smoothing model.\n",
"\n",
"The technical issue discussed there is ultimately the source of the shock-invertibility issues discussed by\n",
"Eric Leeper, Todd Walker, and Susan Yang [[Leeper *et al.*, 2013](https://python-advanced.quantecon.org/zreferences.html#id34)] in their analysis of **fiscal foresight**."
]
}
],
"metadata": {
"date": 1728369868.6019912,
"filename": "cons_news.md",
"kernelspec": {
"display_name": "Python",
"language": "python3",
"name": "python3"
},
"title": "Information and Consumption Smoothing"
},
"nbformat": 4,
"nbformat_minor": 5
}