\n",
" \n",
" \n",
" \n",
"

"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Rational Expectations Equilibrium"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Contents\n",
"\n",
"- [Rational Expectations Equilibrium](#Rational-Expectations-Equilibrium) \n",
" - [Overview](#Overview) \n",
" - [Defining Rational Expectations Equilibrium](#Defining-Rational-Expectations-Equilibrium) \n",
" - [Computation of an Equilibrium](#Computation-of-an-Equilibrium) \n",
" - [Exercises](#Exercises) \n",
" - [Solutions](#Solutions) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"> “If you’re so smart, why aren’t you rich?”"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Overview\n",
"\n",
"This lecture introduces the concept of *rational expectations equilibrium*.\n",
"\n",
"To illustrate it, we describe a linear quadratic version of a famous and important model\n",
"due to Lucas and Prescott [[LP71]](https://julia.quantecon.org/../zreferences.html#lucasprescott1971).\n",
"\n",
"This 1971 paper is one of a small number of research articles that kicked off the *rational expectations revolution*.\n",
"\n",
"We follow Lucas and Prescott by employing a setting that is readily “Bellmanized” (i.e., capable of being formulated in terms of dynamic programming problems).\n",
"\n",
"Because we use linear quadratic setups for demand and costs, we can adapt the LQ programming techniques described in [this lecture](https://julia.quantecon.org/../dynamic_programming/lqcontrol.html).\n",
"\n",
"We will learn about how a representative agent’s problem differs from a planner’s, and how a planning problem can be used to compute rational expectations quantities.\n",
"\n",
"We will also learn about how a rational expectations equilibrium can be characterized as a [fixed point](https://en.wikipedia.org/wiki/Fixed_point_%28mathematics%29) of a mapping from a *perceived law of motion* to an *actual law of motion*.\n",
"\n",
"Equality between a perceived and an actual law of motion for endogenous market-wide objects captures in a nutshell what the rational expectations equilibrium concept is all about.\n",
"\n",
"Finally, we will learn about the important “Big $ K $, little $ k $” trick, a modeling device widely used in macroeconomics.\n",
"\n",
"Except that for us\n",
"\n",
"- Instead of “Big $ K $” it will be “Big $ Y $” \n",
"- Instead of “little $ k $” it will be “little $ y $” "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### The Big $ Y $, little $ y $ trick\n",
"\n",
"This widely used method applies in contexts in which a “representative firm” or agent is a “price taker” operating within a competitive equilibrium.\n",
"\n",
"We want to impose that\n",
"\n",
"- The representative firm or individual takes *aggregate* $ Y $ as given when it chooses individual $ y $, but $ \\ldots $. \n",
"- At the end of the day, $ Y = y $, so that the representative firm is indeed representative. \n",
"\n",
"\n",
"The Big $ Y $, little $ y $ trick accomplishes these two goals by\n",
"\n",
"- Taking $ Y $ as beyond control when posing the choice problem of who chooses $ y $; but $ \\ldots $. \n",
"- Imposing $ Y = y $ *after* having solved the individual’s optimization problem. \n",
"\n",
"\n",
"Please watch for how this strategy is applied as the lecture unfolds.\n",
"\n",
"We begin by applying the Big $ Y $, little $ y $ trick in a very simple static context."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### A simple static example of the Big $ Y $, little $ y $ trick\n",
"\n",
"Consider a static model in which a collection of $ n $ firms produce a homogeneous good that is sold in a competitive market.\n",
"\n",
"Each of these $ n $ firms sells output $ y $.\n",
"\n",
"The price $ p $ of the good lies on an inverse demand curve\n",
"\n",
"\n",
"\n",
"$$\n",
"p = a_0 - a_1 Y \\tag{1}\n",
"$$\n",
"\n",
"where\n",
"\n",
"- $ a_i > 0 $ for $ i = 0, 1 $ \n",
"- $ Y = n y $ is the market-wide level of output \n",
"\n",
"\n",
"Each firm has total cost function\n",
"\n",
"$$\n",
"c(y) = c_1 y + 0.5 c_2 y^2,\n",
"\\qquad c_i > 0 \\text{ for } i = 1,2\n",
"$$\n",
"\n",
"The profits of a representative firm are $ p y - c(y) $.\n",
"\n",
"Using [(1)](#equation-ree-comp3d-static), we can express the problem of the representative firm as\n",
"\n",
"\n",
"\n",
"$$\n",
"\\max_{y} \\Bigl[ (a_0 - a_1 Y) y - c_1 y - 0.5 c_2 y^2 \\Bigr] \\tag{2}\n",
"$$\n",
"\n",
"In posing problem [(2)](#equation-max-problem-static), we want the firm to be a *price taker*.\n",
"\n",
"We do that by regarding $ p $ and therefore $ Y $ as exogenous to the firm.\n",
"\n",
"The essence of the Big $ Y $, little $ y $ trick is *not* to set $ Y = n y $ *before* taking the first-order condition with respect\n",
"to $ y $ in problem [(2)](#equation-max-problem-static).\n",
"\n",
"This assures that the firm is a price taker.\n",
"\n",
"The first order condition for problem [(2)](#equation-max-problem-static) is\n",
"\n",
"\n",
"\n",
"$$\n",
"a_0 - a_1 Y - c_1 - c_2 y = 0 \\tag{3}\n",
"$$\n",
"\n",
"At this point, *but not before*, we substitute $ Y = ny $ into [(3)](#equation-bigysimplefonc)\n",
"to obtain the following linear equation\n",
"\n",
"\n",
"\n",
"$$\n",
"a_0 - c_1 - (a_1 + n^{-1} c_2) Y = 0 \\tag{4}\n",
"$$\n",
"\n",
"to be solved for the competitive equilibrium market wide output $ Y $.\n",
"\n",
"After solving for $ Y $, we can compute the competitive equilibrium price $ p $ from the inverse demand curve [(1)](#equation-ree-comp3d-static)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Further Reading\n",
"\n",
"References for this lecture include\n",
"\n",
"- [[LP71]](https://julia.quantecon.org/../zreferences.html#lucasprescott1971) \n",
"- [[Sar87]](https://julia.quantecon.org/../zreferences.html#sargent1987), chapter XIV \n",
"- [[LS18]](https://julia.quantecon.org/../zreferences.html#ljungqvist2012), chapter 7 "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Setup"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"hide-output": true
},
"outputs": [],
"source": [
"using InstantiateFromURL\n",
"# optionally add arguments to force installation: instantiate = true, precompile = true\n",
"github_project(\"QuantEcon/quantecon-notebooks-julia\", version = \"0.8.0\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"using LinearAlgebra, Statistics"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Defining Rational Expectations Equilibrium\n",
"\n",
"\n",
"\n",
"Our first illustration of a rational expectations equilibrium involves a market with $ n $ firms, each of which seeks to maximize the discounted present value of profits in the face of adjustment costs.\n",
"\n",
"The adjustment costs induce the firms to make gradual adjustments, which in turn requires consideration of future prices.\n",
"\n",
"Individual firms understand that, via the inverse demand curve, the price is determined by the amounts supplied by other firms.\n",
"\n",
"Hence each firm wants to forecast future total industry supplies.\n",
"\n",
"In our context, a forecast is generated by a belief about the law of motion for the aggregate state.\n",
"\n",
"Rational expectations equilibrium prevails when this belief coincides with the actual\n",
"law of motion generated by production choices induced by this belief.\n",
"\n",
"We formulate a rational expectations equilibrium in terms of a fixed point of an operator that maps beliefs into optimal beliefs.\n",
"\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Competitive Equilibrium with Adjustment Costs\n",
"\n",
"\n",
"\n",
"To illustrate, consider a collection of $ n $ firms producing a homogeneous good that is sold in a competitive market.\n",
"\n",
"Each of these $ n $ firms sells output $ y_t $.\n",
"\n",
"The price $ p_t $ of the good lies on the inverse demand curve\n",
"\n",
"\n",
"\n",
"$$\n",
"p_t = a_0 - a_1 Y_t \\tag{5}\n",
"$$\n",
"\n",
"where\n",
"\n",
"- $ a_i > 0 $ for $ i = 0, 1 $ \n",
"- $ Y_t = n y_t $ is the market-wide level of output \n",
"\n",
"\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The Firm’s Problem\n",
"\n",
"Each firm is a price taker.\n",
"\n",
"While it faces no uncertainty, it does face adjustment costs\n",
"\n",
"In particular, it chooses a production plan to maximize\n",
"\n",
"\n",
"\n",
"$$\n",
"\\sum_{t=0}^\\infty \\beta^t r_t \\tag{6}\n",
"$$\n",
"\n",
"where\n",
"\n",
"\n",
"\n",
"$$\n",
"r_t := p_t y_t - \\frac{ \\gamma (y_{t+1} - y_t )^2 }{2},\n",
"\\qquad y_0 \\text{ given} \\tag{7}\n",
"$$\n",
"\n",
"Regarding the parameters,\n",
"\n",
"- $ \\beta \\in (0,1) $ is a discount factor \n",
"- $ \\gamma > 0 $ measures the cost of adjusting the rate of output \n",
"\n",
"\n",
"Regarding timing, the firm observes $ p_t $ and $ y_t $ when it chooses $ y_{t+1} $ at at time $ t $.\n",
"\n",
"To state the firm’s optimization problem completely requires that we specify dynamics for all state variables.\n",
"\n",
"This includes ones that the firm cares about but does not control like $ p_t $.\n",
"\n",
"We turn to this problem now."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Prices and Aggregate Output\n",
"\n",
"In view of [(5)](#equation-ree-comp3d), the firm’s incentive to forecast the market price translates into an incentive to forecast aggregate output $ Y_t $.\n",
"\n",
"Aggregate output depends on the choices of other firms.\n",
"\n",
"We assume that $ n $ is such a large number that the output of any single firm has a negligible effect on aggregate output.\n",
"\n",
"That justifies firms in regarding their forecasts of aggregate output as being unaffected by their own output decisions."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The Firm’s Beliefs\n",
"\n",
"We suppose the firm believes that market-wide output $ Y_t $ follows the law of motion\n",
"\n",
"\n",
"\n",
"$$\n",
"Y_{t+1} = H(Y_t) \\tag{8}\n",
"$$\n",
"\n",
"where $ Y_0 $ is a known initial condition.\n",
"\n",
"The *belief function* $ H $ is an equilibrium object, and hence remains to be determined."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Optimal Behavior Given Beliefs\n",
"\n",
"For now let’s fix a particular belief $ H $ in [(8)](#equation-ree-hlom) and investigate the firm’s response to it.\n",
"\n",
"Let $ v $ be the optimal value function for the firm’s problem given $ H $.\n",
"\n",
"The value function satisfies the Bellman equation\n",
"\n",
"\n",
"\n",
"$$\n",
"v(y,Y) = \\max_{y'} \\left\\{ a_0 y - a_1 y Y - \\frac{ \\gamma (y' - y)^2}{2} + \\beta v(y', H(Y))\\right\\} \\tag{9}\n",
"$$\n",
"\n",
"Let’s denote the firm’s optimal policy function by $ h $, so that\n",
"\n",
"\n",
"\n",
"$$\n",
"y_{t+1} = h(y_t, Y_t) \\tag{10}\n",
"$$\n",
"\n",
"where\n",
"\n",
"\n",
"\n",
"$$\n",
"h(y, Y) := \\mathop{\\mathrm{arg\\,max}}_{y'}\n",
"\\left\\{ a_0 y - a_1 y Y - \\frac{ \\gamma (y' - y)^2}{2} + \\beta v(y', H(Y))\\right\\} \\tag{11}\n",
"$$\n",
"\n",
"Evidently $ v $ and $ h $ both depend on $ H $."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### First-Order Characterization of $ h $\n",
"\n",
"In what follows it will be helpful to have a second characterization of $ h $, based on first order conditions.\n",
"\n",
"The first-order necessary condition for choosing $ y' $ is\n",
"\n",
"\n",
"\n",
"$$\n",
"-\\gamma (y' - y) + \\beta v_y(y',H(Y)) =0 \\tag{12}\n",
"$$\n",
"\n",
"An important useful envelope result of Benveniste-Scheinkman [[BS79]](https://julia.quantecon.org/../zreferences.html#benvenistescheinkman1979) implies that to\n",
"differentiate $ v $ with respect to $ y $ we can naively differentiate\n",
"the right side of [(9)](#equation-comp4), giving\n",
"\n",
"$$\n",
"v_y(y,Y) = a_0 - a_1 Y + \\gamma (y' - y)\n",
"$$\n",
"\n",
"Substituting this equation into [(12)](#equation-comp5) gives the *Euler equation*\n",
"\n",
"\n",
"\n",
"$$\n",
"-\\gamma (y_{t+1} - y_t) + \\beta [a_0 - a_1 Y_{t+1} + \\gamma (y_{t+2} - y_{t+1} )] =0 \\tag{13}\n",
"$$\n",
"\n",
"The firm optimally sets an output path that satisfies [(13)](#equation-ree-comp7), taking [(8)](#equation-ree-hlom) as given, and subject to\n",
"\n",
"- the initial conditions for $ (y_0, Y_0) $ \n",
"- the terminal condition $ \\lim_{t \\rightarrow \\infty } \\beta^t y_t v_y(y_{t}, Y_t) = 0 $ \n",
"\n",
"\n",
"This last condition is called the *transversality condition*, and acts as a first-order necessary condition “at infinity”.\n",
"\n",
"The firm’s decision rule solves the difference equation [(13)](#equation-ree-comp7) subject to the given initial condition $ y_0 $ and the transversality condition.\n",
"\n",
"Note that solving the Bellman equation [(9)](#equation-comp4) for $ v $ and then $ h $ in [(11)](#equation-ree-opbe) yields\n",
"a decision rule that automatically imposes both the Euler equation [(13)](#equation-ree-comp7) and the transversality condition."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The Actual Law of Motion for $ \\{Y_t\\} $\n",
"\n",
"As we’ve seen, a given belief translates into a particular decision rule $ h $.\n",
"\n",
"Recalling that $ Y_t = ny_t $, the *actual law of motion* for market-wide output is then\n",
"\n",
"\n",
"\n",
"$$\n",
"Y_{t+1} = n h(Y_t/n, Y_t) \\tag{14}\n",
"$$\n",
"\n",
"Thus, when firms believe that the law of motion for market-wide output is [(8)](#equation-ree-hlom), their optimizing behavior makes the actual law of motion be [(14)](#equation-ree-comp9a).\n",
"\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Definition of Rational Expectations Equilibrium\n",
"\n",
"A *rational expectations equilibrium* or *recursive competitive equilibrium* of the model with adjustment costs is a decision rule $ h $ and an aggregate law of motion $ H $ such that\n",
"\n",
"1. Given belief $ H $, the map $ h $ is the firm’s optimal policy function. \n",
"1. The law of motion $ H $ satisfies $ H(Y)= nh(Y/n,Y) $ for all.\n",
" $ Y $ \n",
"\n",
"\n",
"Thus, a rational expectations equilibrium equates the perceived and actual laws of motion [(8)](#equation-ree-hlom) and [(14)](#equation-ree-comp9a)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Fixed point characterization\n",
"\n",
"As we’ve seen, the firm’s optimum problem induces a mapping $ \\Phi $ from a perceived law of motion $ H $ for market-wide output to an actual law of motion $ \\Phi(H) $.\n",
"\n",
"The mapping $ \\Phi $ is the composition of two operations, taking a perceived law of motion into a decision rule via [(9)](#equation-comp4)–[(11)](#equation-ree-opbe), and a decision rule into an actual law via [(14)](#equation-ree-comp9a).\n",
"\n",
"The $ H $ component of a rational expectations equilibrium is a fixed point of $ \\Phi $."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Computation of an Equilibrium\n",
"\n",
"\n",
"\n",
"Now let’s consider the problem of computing the rational expectations\n",
"equilibrium."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Misbehavior of $ \\Phi $\n",
"\n",
"Readers accustomed to dynamic programming arguments might try to address this problem by choosing some guess $ H_0 $ for the aggregate law of motion and then iterating with $ \\Phi $.\n",
"\n",
"Unfortunately, the mapping $ \\Phi $ is not a contraction.\n",
"\n",
"In particular, there is no guarantee that direct iterations on $ \\Phi $ converge **[1]** A literature that studies whether models populated with agents\n",
"who learn can converge to rational expectations equilibria features\n",
"iterations on a modification of the mapping $ \\Phi $ that can be\n",
"approximated as $ \\gamma \\Phi + (1-\\gamma)I $. Here $ I $ is the\n",
"identity operator and $ \\gamma \\in (0,1) $ is a *relaxation parameter*.\n",
"See [[MS89]](https://julia.quantecon.org/../zreferences.html#marcetsargent1989) and [[EH01]](https://julia.quantecon.org/../zreferences.html#evanshonkapohja2001) for statements\n",
"and applications of this approach to establish conditions under which\n",
"collections of adaptive agents who use least squares learning converge to a\n",
"rational expectations equilibrium."
]
}
],
"metadata": {
"date": 1591310625.9276826,
"download_nb": 1,
"download_nb_path": "https://julia.quantecon.org/",
"filename": "rational_expectations.rst",
"filename_with_path": "multi_agent_models/rational_expectations",
"kernelspec": {
"display_name": "Julia 1.4.2",
"language": "julia",
"name": "julia-1.4"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.4.2"
},
"title": "Rational Expectations Equilibrium"
},
"nbformat": 4,
"nbformat_minor": 2
}