Code should execute sequentially if run in a Jupyter notebook

- See the set up page to install Jupyter, Python and all necessary libraries
- Please direct feedback to contact@quantecon.org or the discourse forum

# Lucas Asset Pricing Using DLE¶

**Co-author:** Sebastian Graves

This is one of a suite of lectures that use the quantecon DLE class to instantiate models within the [HS13b] class of models described in detail in Recursive Models of Dynamic Linear Economies

In addition to what’s in Anaconda, this lecture uses the quantecon library

```
!pip install quantecon
```

This lecture uses the DLE class to price payout streams that are linear functions of the economy’s state vector, as well as risk-free assets that pay out one unit of the first consumption good with certainty

We assume basic knowledge of the class of economic environments that fall within the domain of the DLE class

Many details about the basic environment are contained in the lecture Growth in Dynamic Linear Economies

We’ll also need the following imports

```
import numpy as np
import matplotlib.pyplot as plt
from quantecon import LQ
from quantecon import DLE
%matplotlib inline
```

We use a linear-quadratic version of an economy that Lucas (1978) [Luc78] used to develop an equilibrium theory of asset prices:

**Preferences**

**Technology**

**Information**

## Asset Pricing Equations¶

[HS13b] show that the time t value of a permanent claim to a stream $ y_s = U_ax_s \, , s \geq t $ is:

$$ a_t = (x_t'\mu_ax_t + \sigma_a)/(\bar e _1M_cx_t) $$with

$$ \mu_a = \sum_{\tau = 0}^\infty \beta^\tau(A^{o'})^\tau Z_a A^{o\tau} $$$$ \sigma_a = \frac{\beta}{1-\beta} \text{trace} (Z_a \sum_{\tau = 0}^\infty \beta^\tau (A^{o})^\tau C C^{'} (A^{o'})^\tau) $$where

$$ Z_a = U_a^{'}M_c $$The use of $ \bar e _1 $ indicates that the first consumption good is the numeraire

## Asset Pricing Simulations¶

```
gam = 0
γ = np.array([[gam], [0]])
ϕ_c = np.array([[1], [0]])
ϕ_g = np.array([[0], [1]])
ϕ_1 = 1e-4
ϕ_i = np.array([[0], [-ϕ_1]])
δ_k = np.array([[.95]])
θ_k = np.array([[1]])
β = np.array([[1 / 1.05]])
ud = np.array([[5, 1, 0],
[0, 0, 0]])
a22 = np.array([[1, 0, 0],
[0, 0.8, 0],
[0, 0, 0.5]])
c2 = np.array([[0, 1, 0],
[0, 0, 1]]).T
l_λ = np.array([[0]])
π_h = np.array([[1]])
δ_h = np.array([[.9]])
θ_h = np.array([[1]]) - δ_h
ub = np.array([[30, 0, 0]])
x0 = np.array([[5, 150, 1, 0, 0]]).T
Info1 = (a22, c2, ub, ud)
Tech1 = (ϕ_c, ϕ_g, ϕ_i, γ, δ_k, θ_k)
Pref1 = (β, l_λ, π_h, δ_h, θ_h)
```

```
Econ1 = DLE(Info1, Tech1, Pref1)
```

After specifying a “Pay” matrix, we simulate the economy

The particular choice of “Pay” used below means that we are pricing a perpetual claim on the endowment process $ d_{1t} $

```
Econ1.compute_sequence(x0, ts_length=100, Pay=np.array([Econ1.Sd[0, :]]))
```

The graph below plots the price of this claim over time:

```
### Fig 7.12.1 from p.147 of HS2013
plt.plot(Econ1.Pay_Price, label='Price of Tree')
plt.legend()
plt.show()
```

The next plot displays the realized gross rate of return on this “Lucas tree” as well as on a risk-free one-period bond:

```
### Left panel of Fig 7.12.2 from p.148 of HS2013
plt.plot(Econ1.Pay_Gross, label='Tree')
plt.plot(Econ1.R1_Gross, label='Risk-Free')
plt.legend()
plt.show()
```

```
np.corrcoef(Econ1.Pay_Gross[1:, 0], Econ1.R1_Gross[1:, 0])
```

Above we have also calculated the correlation coefficient between these two returns

To give an idea of how the term structure of interest rates moves in
this economy, the next plot displays the *net* rates of return on
one-period and five-period risk-free bonds:

```
### Right panel of Fig 7.12.2 from p.148 of HS2013
plt.plot(Econ1.R1_Net, label='One-Period')
plt.plot(Econ1.R5_Net, label='Five-Period')
plt.legend()
plt.show()
```

From the above plot, we can see the tendency of the term structure to slope up when rates are low, and to slope down when rates are high

Comparing it to the previous plot of the price of the “Lucas tree”, we can also see that net rates of return are low when the price of the tree is high, and vice versa

We now plot the realized gross rate of return on a “Lucas tree” as well as on a risk-free one-period bond when the autoregressive parameter for the endowment process is reduced to 0.4:

```
a22_2 = np.array([[1, 0, 0],
[0, 0.4, 0],
[0, 0, 0.5]])
Info2 = (a22_2, c2, ub, ud)
Econ2 = DLE(Info2, Tech1, Pref1)
Econ2.compute_sequence(x0, ts_length=100, Pay=np.array([Econ2.Sd[0, :]]))
```

```
### Left panel of Fig 7.12.3 from p.148 of HS2013
plt.plot(Econ2.Pay_Gross, label='Tree')
plt.plot(Econ2.R1_Gross, label='Risk-Free')
plt.legend()
plt.show()
```

```
np.corrcoef(Econ2.Pay_Gross[1:, 0], Econ2.R1_Gross[1:, 0])
```

The correlation between these two gross rates is now more negative

Next, we again plot the *net* rates of return on one-period and
five-period risk-free bonds:

```
### Right panel of Fig 7.12.3 from p.148 of HS2013
plt.plot(Econ2.R1_Net, label='One-Period')
plt.plot(Econ2.R5_Net, label='Five-Period')
plt.legend()
plt.show()
```

We can see the tendency of the term structure to slope up when rates are low (and down when rates are high) has been accentuated relative to the first instance of our economy