Solutions for http://quant-econ.net/py/lucas_model.html
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
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))
Out[4]:
In [ ]: