quant-econ Solutions: The Lucas Asset Pricing Model


In [2]:
%matplotlib inline

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

Exercise 1


In [4]:
# == Define primitives == #
n = 5
P = 0.0125 * np.ones((n, n))
P += np.diag(0.95 - 0.0125 * np.ones(5))
s = np.array([1.05, 1.025, 1.0, 0.975, 0.95])
gamma = 2.0
beta = 0.94
zeta = 1.0

ap = AssetPrices(beta, P, s, gamma)

v = ap.tree_price()
print("Lucas Tree Prices: ", v)

v_consol = ap.consol_price(zeta)
print("Consol Bond Prices: ", v_consol)

P_tilde = P * s**(1-gamma)
temp = beta * P_tilde.dot(v) + beta * P_tilde.dot(np.ones(n))
print("Should be 0: ",  v - temp)

p_s = 150.0
w_bar, w_bars = ap.call_option(zeta, p_s, T = [10,20,30])


('Lucas Tree Prices: ', array([ 12.72221763,  14.72515002,  17.57142236,  21.93570661,  29.47401578]))
('Consol Bond Prices: ', array([  87.56860139,  109.25108965,  148.67554548,  242.55144082,
        753.87100476]))
('Should be 0: ', array([ -1.77635684e-15,  -1.77635684e-15,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00]))

In [ ]: