# 66. Rational Expectations Equilibrium¶

“If you’re so smart, why aren’t you rich?”

In addition to what’s in Anaconda, this lecture will need the following libraries:

!pip install quantecon

Requirement already satisfied: quantecon in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (0.5.3)

Requirement already satisfied: scipy>=1.0.0 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quantecon) (1.7.3)
Requirement already satisfied: numba in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quantecon) (0.56.2)
Requirement already satisfied: sympy in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quantecon) (1.10.1)
Requirement already satisfied: requests in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quantecon) (2.27.1)
Requirement already satisfied: numpy in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from quantecon) (1.22.4)
Requirement already satisfied: setuptools<60 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from numba->quantecon) (59.8.0)
Requirement already satisfied: llvmlite<0.40,>=0.39.0dev0 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from numba->quantecon) (0.39.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from requests->quantecon) (2021.10.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from requests->quantecon) (2.0.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from requests->quantecon) (1.26.9)
Requirement already satisfied: idna<4,>=2.5 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from requests->quantecon) (3.3)

Requirement already satisfied: mpmath>=0.19 in /usr/share/miniconda3/envs/quantecon/lib/python3.9/site-packages (from sympy->quantecon) (1.2.1)


## 66.1. Overview¶

This lecture introduces the concept of a rational expectations equilibrium.

To illustrate it, we describe a linear quadratic version of a model due to Lucas and Prescott [LP71].

That 1971 paper is one of a small number of research articles that ignited a rational expectations revolution.

We follow Lucas and Prescott by employing a setting that is readily “Bellmanized” (i.e., susceptible to being formulated as a dynamic programming problems.

Because we use linear quadratic setups for demand and costs, we can deploy the LQ programming techniques described in this lecture.

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 quantities and prices in a rational expectations equilibrium.

We will also learn about how a rational expectations equilibrium can be characterized as a fixed point of a mapping from a perceived law of motion to an actual law of motion.

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.

Finally, we will learn about the important “Big $$K$$, little $$k$$” trick, a modeling device widely used in macroeconomics.

Except that for us

• Instead of “Big $$K$$” it will be “Big $$Y$$”.

• Instead of “little $$k$$” it will be “little $$y$$”.

%matplotlib inline
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (11, 5)  #set default figure size
import numpy as np


We’ll also use the LQ class from QuantEcon.py.

from quantecon import LQ


### 66.1.1. The Big Y, little y Trick¶

This widely used method applies in contexts in which a representative firm or agent is a “price taker” operating within a competitive equilibrium.

The following setting justifies the concept of a representative firm that stands in for a large number of other firms too.

There is a uniform unit measure of identical firms named $$\omega \in \Omega = [0,1]$$.

The output of firm $$\omega$$ is $$y(\omega)$$.

The output of all firms is $$Y = \int_{0}^1 y(\omega) d \, \omega$$.

All firms end up choosing to produce the same output, so that at the end of the day $$y(\omega) = y$$ and $$Y =y = \int_{0}^1 y(\omega) d \, \omega$$.

This setting allows us to speak of a representative firm that chooses to produce $$y$$.

We want to impose that

• The representative firm or individual firm takes aggregate $$Y$$ as given when it chooses individual $$y(\omega)$$, but $$\ldots$$.

• At the end of the day, $$Y = y(\omega) = y$$, so that the representative firm is indeed representative.

The Big $$Y$$, little $$y$$ trick accomplishes these two goals by

• Taking $$Y$$ as beyond control when posing the choice problem of who chooses $$y$$; but $$\ldots$$.

• Imposing $$Y = y$$ after having solved the individual’s optimization problem.

Please watch for how this strategy is applied as the lecture unfolds.

We begin by applying the Big $$Y$$, little $$y$$ trick in a very simple static context.

#### 66.1.1.1. A Simple Static Example of the Big Y, little y Trick¶

Consider a static model in which a unit measure of firms produce a homogeneous good that is sold in a competitive market.

Each of these firms ends up producing and selling output $$y (\omega) = y$$.

The price $$p$$ of the good lies on an inverse demand curve

(66.1)$p = a_0 - a_1 Y$

where

• $$a_i > 0$$ for $$i = 0, 1$$

• $$Y = \int_0^1 y(\omega) d \omega$$ is the market-wide level of output

For convenience, we’ll often just write $$y$$ instead of $$y(\omega)$$ when we are describing the choice problem of an individual firm $$\omega \in \Omega$$.

Each firm has a total cost function

$c(y) = c_1 y + 0.5 c_2 y^2, \qquad c_i > 0 \text{ for } i = 1,2$

The profits of a representative firm are $$p y - c(y)$$.

Using (66.1), we can express the problem of the representative firm as

(66.2)$\max_{y} \Bigl[ (a_0 - a_1 Y) y - c_1 y - 0.5 c_2 y^2 \Bigr]$

In posing problem (66.2), we want the firm to be a price taker.

We do that by regarding $$p$$ and therefore $$Y$$ as exogenous to the firm.

The essence of the Big $$Y$$, little $$y$$ trick is not to set $$Y = n y$$ before taking the first-order condition with respect to $$y$$ in problem (66.2).

This assures that the firm is a price taker.

The first-order condition for problem (66.2) is

(66.3)$a_0 - a_1 Y - c_1 - c_2 y = 0$

At this point, but not before, we substitute $$Y = y$$ into (66.3) to obtain the following linear equation

(66.4)$a_0 - c_1 - (a_1 + c_2) Y = 0$

to be solved for the competitive equilibrium market-wide output $$Y$$.

After solving for $$Y$$, we can compute the competitive equilibrium price $$p$$ from the inverse demand curve (66.1).

References for this lecture include

## 66.2. Rational Expectations Equilibrium¶

Our first illustration of a rational expectations equilibrium involves a market with a unit measure of identical firms, each of which seeks to maximize the discounted present value of profits in the face of adjustment costs.

The adjustment costs induce the firms to make gradual adjustments, which in turn requires consideration of future prices.

Individual firms understand that, via the inverse demand curve, the price is determined by the amounts supplied by other firms.

Hence each firm wants to forecast future total industry output.

In our context, a forecast is generated by a belief about the law of motion for the aggregate state.

Rational expectations equilibrium prevails when this belief coincides with the actual law of motion generated by production choices induced by this belief.

We formulate a rational expectations equilibrium in terms of a fixed point of an operator that maps beliefs into optimal beliefs.

### 66.2.1. Competitive Equilibrium with Adjustment Costs¶

To illustrate, consider a collection of $$n$$ firms producing a homogeneous good that is sold in a competitive market.

Each firm sell output $$y_t(\omega) = y_t$$.

The price $$p_t$$ of the good lies on the inverse demand curve

(66.5)$p_t = a_0 - a_1 Y_t$

where

• $$a_i > 0$$ for $$i = 0, 1$$

• $$Y_t = \int_0^1 y_t(\omega) d \omega = y_t$$ is the market-wide level of output

#### 66.2.1.1. The Firm’s Problem¶

Each firm is a price taker.

While it faces no uncertainty, it does face adjustment costs

In particular, it chooses a production plan to maximize

(66.6)$\sum_{t=0}^\infty \beta^t r_t$

where

(66.7)$r_t := p_t y_t - \frac{ \gamma (y_{t+1} - y_t )^2 }{2}, \qquad y_0 \text{ given}$

Regarding the parameters,

• $$\beta \in (0,1)$$ is a discount factor

• $$\gamma > 0$$ measures the cost of adjusting the rate of output

Regarding timing, the firm observes $$p_t$$ and $$y_t$$ when it chooses $$y_{t+1}$$ at time $$t$$.

To state the firm’s optimization problem completely requires that we specify dynamics for all state variables.

This includes ones that the firm cares about but does not control like $$p_t$$.

We turn to this problem now.

#### 66.2.1.2. Prices and Aggregate Output¶

In view of (66.5), the firm’s incentive to forecast the market price translates into an incentive to forecast aggregate output $$Y_t$$.

Aggregate output depends on the choices of other firms.

The output $$y_t(\omega)$$ of a single firm $$\omega$$ has a negligible effect on aggregate output $$\int_0^1 y_t(\omega) d \omega$$.

That justifies firms in regarding their forecasts of aggregate output as being unaffected by their own output decisions.

#### 66.2.1.3. Representative Firm’s Beliefs¶

We suppose the firm believes that market-wide output $$Y_t$$ follows the law of motion

(66.8)$Y_{t+1} = H(Y_t)$

where $$Y_0$$ is a known initial condition.

The belief function $$H$$ is an equilibrium object, and hence remains to be determined.

#### 66.2.1.4. Optimal Behavior Given Beliefs¶

For now, let’s fix a particular belief $$H$$ in (66.8) and investigate the firm’s response to it.

Let $$v$$ be the optimal value function for the firm’s problem given $$H$$.

The value function satisfies the Bellman equation

(66.9)$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\}$

Let’s denote the firm’s optimal policy function by $$h$$, so that

(66.10)$y_{t+1} = h(y_t, Y_t)$

where

(66.11)$h(y, Y) := \textrm{argmax}_{y'} \left\{ a_0 y - a_1 y Y - \frac{ \gamma (y' - y)^2}{2} + \beta v(y', H(Y))\right\}$

Evidently $$v$$ and $$h$$ both depend on $$H$$.

#### 66.2.1.5. Characterization with First-Order Necessary Conditions¶

In what follows it will be helpful to have a second characterization of $$h$$, based on first-order conditions.

The first-order necessary condition for choosing $$y'$$ is

(66.12)$-\gamma (y' - y) + \beta v_y(y', H(Y) ) = 0$

An important useful envelope result of Benveniste-Scheinkman [BS79] implies that to differentiate $$v$$ with respect to $$y$$ we can naively differentiate the right side of (66.9), giving

$v_y(y,Y) = a_0 - a_1 Y + \gamma (y' - y)$

Substituting this equation into (66.12) gives the Euler equation

(66.13)$-\gamma (y_{t+1} - y_t) + \beta [a_0 - a_1 Y_{t+1} + \gamma (y_{t+2} - y_{t+1} )] =0$

The firm optimally sets an output path that satisfies (66.13), taking (66.8) as given, and subject to

• the initial conditions for $$(y_0, Y_0)$$.

• the terminal condition $$\lim_{t \rightarrow \infty } \beta^t y_t v_y(y_{t}, Y_t) = 0$$.

This last condition is called the transversality condition, and acts as a first-order necessary condition “at infinity”.

A representative firm’s decision rule solves the difference equation (66.13) subject to the given initial condition $$y_0$$ and the transversality condition.

Note that solving the Bellman equation (66.9) for $$v$$ and then $$h$$ in (66.11) yields a decision rule that automatically imposes both the Euler equation (66.13) and the transversality condition.

#### 66.2.1.6. The Actual Law of Motion for Output¶

As we’ve seen, a given belief translates into a particular decision rule $$h$$.

Recalling that in equilbrium $$Y_t = y_t$$, the actual law of motion for market-wide output is then

(66.14)$Y_{t+1} = h(Y_t, Y_t)$

Thus, when firms believe that the law of motion for market-wide output is (66.8), their optimizing behavior makes the actual law of motion be (66.14).

### 66.2.2. Definition of Rational Expectations Equilibrium¶

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

1. Given belief $$H$$, the map $$h$$ is the firm’s optimal policy function.

2. The law of motion $$H$$ satisfies $$H(Y)= h(Y,Y)$$ for all $$Y$$.

Thus, a rational expectations equilibrium equates the perceived and actual laws of motion (66.8) and (66.14).

#### 66.2.2.1. Fixed Point Characterization¶

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)$$.

The mapping $$\Phi$$ is the composition of two mappings, the first of which maps a perceived law of motion into a decision rule via (66.9)(66.11), the second of which maps a decision rule into an actual law via (66.14).

The $$H$$ component of a rational expectations equilibrium is a fixed point of $$\Phi$$.

## 66.3. Computing an Equilibrium¶

Now let’s compute a rational expectations equilibrium.

### 66.3.1. Failure of Contractivity¶

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$$.

Unfortunately, the mapping $$\Phi$$ is not a contraction.

Indeed, there is no guarantee that direct iterations on $$\Phi$$ converge 1.

There are examples in which these iterations diverge.

Fortunately, another method works here.

The method exploits a connection between equilibrium and Pareto optimality expressed in the fundamental theorems of welfare economics (see, e.g, [MCWG95]).

Lucas and Prescott [LP71] used this method to construct a rational expectations equilibrium.

Some details follow.

### 66.3.2. A Planning Problem Approach¶

Our plan of attack is to match the Euler equations of the market problem with those for a single-agent choice problem.

As we’ll see, this planning problem can be solved by LQ control (linear regulator).

Optimal quantities from the planning problem are rational expectations equilibrium quantities.

The rational expectations equilibrium price can be obtained as a shadow price in the planning problem.

We first compute a sum of consumer and producer surplus at time $$t$$

(66.15)$s(Y_t, Y_{t+1}) := \int_0^{Y_t} (a_0 - a_1 x) \, dx - \frac{ \gamma (Y_{t+1} - Y_t)^2}{2}$

The first term is the area under the demand curve, while the second measures the social costs of changing output.

The planning problem is to choose a production plan $$\{Y_t\}$$ to maximize

$\sum_{t=0}^\infty \beta^t s(Y_t, Y_{t+1})$

subject to an initial condition for $$Y_0$$.

### 66.3.3. Solution of Planning Problem¶

Evaluating the integral in (66.15) yields the quadratic form $$a_0 Y_t - a_1 Y_t^2 / 2$$.

As a result, the Bellman equation for the planning problem is

(66.16)$V(Y) = \max_{Y'} \left\{a_0 Y - {a_1 \over 2} Y^2 - \frac{ \gamma (Y' - Y)^2}{2} + \beta V(Y') \right\}$

The associated first-order condition is

(66.17)$-\gamma (Y' - Y) + \beta V'(Y') = 0$

Applying the same Benveniste-Scheinkman formula gives

$V'(Y) = a_0 - a_1 Y + \gamma (Y' - Y)$

Substituting this into equation (66.17) and rearranging leads to the Euler equation

(66.18)$\beta a_0 + \gamma Y_t - [\beta a_1 + \gamma (1+ \beta)]Y_{t+1} + \gamma \beta Y_{t+2} =0$

### 66.3.4. Key Insight¶

Return to equation (66.13) and set $$y_t = Y_t$$ for all $$t$$.

A small amount of algebra will convince you that when $$y_t=Y_t$$, equations (66.18) and (66.13) are identical.

Thus, the Euler equation for the planning problem matches the second-order difference equation that we derived by

1. finding the Euler equation of the representative firm and

2. substituting into it the expression $$Y_t = y_t$$ that “makes the representative firm be representative”.

If it is appropriate to apply the same terminal conditions for these two difference equations, which it is, then we have verified that a solution of the planning problem is also a rational expectations equilibrium quantity sequence.

It follows that for this example we can compute equilibrium quantities by forming the optimal linear regulator problem corresponding to the Bellman equation (66.16).

The optimal policy function for the planning problem is the aggregate law of motion $$H$$ that the representative firm faces within a rational expectations equilibrium.

#### 66.3.4.1. Structure of the Law of Motion¶

As you are asked to show in the exercises, the fact that the planner’s problem is an LQ control problem implies an optimal policy — and hence aggregate law of motion — taking the form

(66.19)$Y_{t+1} = \kappa_0 + \kappa_1 Y_t$

for some parameter pair $$\kappa_0, \kappa_1$$.

Now that we know the aggregate law of motion is linear, we can see from the firm’s Bellman equation (66.9) that the firm’s problem can also be framed as an LQ problem.

As you’re asked to show in the exercises, the LQ formulation of the firm’s problem implies a law of motion that looks as follows

(66.20)$y_{t+1} = h_0 + h_1 y_t + h_2 Y_t$

Hence a rational expectations equilibrium will be defined by the parameters $$(\kappa_0, \kappa_1, h_0, h_1, h_2)$$ in (66.19)(66.20).

## 66.4. Exercises¶

Exercise 66.1

Consider the firm problem described above.

Let the firm’s belief function $$H$$ be as given in (66.19).

Formulate the firm’s problem as a discounted optimal linear regulator problem, being careful to describe all of the objects needed.

Use the class LQ from the QuantEcon.py package to solve the firm’s problem for the following parameter values:

$a_0= 100, a_1= 0.05, \beta = 0.95, \gamma=10, \kappa_0 = 95.5, \kappa_1 = 0.95$

Express the solution of the firm’s problem in the form (66.20) and give the values for each $$h_j$$.

If there were a unit measure of identical competitive firms all behaving according to (66.20), what would (66.20) imply for the actual law of motion (66.8) for market supply.

Exercise 66.2

Consider the following $$\kappa_0, \kappa_1$$ pairs as candidates for the aggregate law of motion component of a rational expectations equilibrium (see (66.19)).

Extending the program that you wrote for Exercise 66.1, determine which if any satisfy the definition of a rational expectations equilibrium

• (94.0886298678, 0.923409232937)

• (93.2119845412, 0.984323478873)

• (95.0818452486, 0.952459076301)

Describe an iterative algorithm that uses the program that you wrote for Exercise 66.1 to compute a rational expectations equilibrium.

(You are not being asked actually to use the algorithm you are suggesting)

Exercise 66.3

Recall the planner’s problem described above

1. Formulate the planner’s problem as an LQ problem.

2. Solve it using the same parameter values in exercise 1

• $$a_0= 100, a_1= 0.05, \beta = 0.95, \gamma=10$$

3. Represent the solution in the form $$Y_{t+1} = \kappa_0 + \kappa_1 Y_t$$.

Exercise 66.4

A monopolist faces the industry demand curve (66.5) and chooses $$\{Y_t\}$$ to maximize $$\sum_{t=0}^{\infty} \beta^t r_t$$ where

$r_t = p_t Y_t - \frac{\gamma (Y_{t+1} - Y_t)^2 }{2}$

Formulate this problem as an LQ problem.

Compute the optimal policy using the same parameters as Exercise 66.2.

In particular, solve for the parameters in

$Y_{t+1} = m_0 + m_1 Y_t$

Compare your results with Exercise 66.2 – comment.

## 66.5. Solutions¶

1

A literature that studies whether models populated with agents who learn can converge to rational expectations equilibria features iterations on a modification of the mapping $$\Phi$$ that can be approximated as $$\gamma \Phi + (1-\gamma)I$$. Here $$I$$ is the identity operator and $$\gamma \in (0,1)$$ is a relaxation parameter. See [MS89] and [EH01] for statements and applications of this approach to establish conditions under which collections of adaptive agents who use least squares learning to converge to a rational expectations equilibrium.