quant-econ Solutions: The Lucas Asset Pricing Model


In [1]:
%matplotlib inline

Let's start with standard imports


In [2]:
from __future__ import division  # Omit for Python 3.x
import numpy as np
import matplotlib.pyplot as plt
from quantecon.models import LucasTree

Exercise 1


In [4]:
fig, ax = plt.subplots(figsize=(10,7))

ax.set_xlabel(r'$y$', fontsize=16)
ax.set_ylabel(r'price', fontsize=16)

for beta in (.95, 0.98):
    print("Comuting at beta = {}".format(beta))
    tree = LucasTree(gamma=2, beta=beta, alpha=0.90, sigma=0.1)
    grid, price_vals = tree.grid, tree.compute_lt_price()
    label = r'$\beta = {}$'.format(beta)
    ax.plot(grid, price_vals, lw=2, alpha=0.7, label=label)

ax.legend(loc='upper left')
ax.set_xlim(min(grid), max(grid))


Comuting at beta = 0.95
Comuting at beta = 0.98
Out[4]:
(0.39945149497311855, 2.5034328637756031)

In [ ]: