In [1]:
include("bansal_yaron_parameters.jl")
include("bansal_yaron_discretized.jl")
Out[1]:
In [2]:
using PyPlot
plt = PyPlot
Out[2]:
In [3]:
I=14
J=24
L=20
Out[3]:
In [4]:
ez = EpsteinZinBY()
sv = StochasticVolatilityBY()
Out[4]:
In [6]:
σ_vals, z_vals, W = compute_fp_bansal_yaron(ez, sv, I=I, J=J, L=L);
In [7]:
size(W)
Out[7]:
In [8]:
σ_vals
Out[8]:
In [11]:
using QuantEcon: meshgrid
fig = figure(figsize=(8,6))
ax = fig[:gca](projection="3d")
ax[:view_init](40, 230)
xgrid, ygrid = meshgrid(z_vals, σ_vals)
ctr1 = ax[:plot_surface](xgrid,
ygrid,
W,
cmap=ColorMap("jet"),
alpha=0.7,
rstride=1, cstride=1,
linewidth=0.5)
#plt.clabel(ctr1, inline=1, fontsize=13)
#plt.colorbar(ctr1, ax=ax)
ax[:set_zlabel]("V", labelpad=10)
ax[:set_xlabel]("z", labelpad=10, fontsize=14)
ax[:set_ylabel]("σ", labelpad=10, fontsize=12)
#plt.savefig("foo.pdf")
plt.show()
In [10]:
fig, ax = plt.subplots(figsize=(10, 5.7))
cs1 = ax[:contourf](σ_vals,
z_vals,
W',
alpha=0.6)
#levels=lvs,
ctr1 = ax[:contour](σ_vals,
z_vals,
W')
plt.clabel(ctr1, inline=1, fontsize=13)
plt.colorbar(cs1, ax=ax)
ax[:set_title]("Utility")
ax[:set_xlabel]("σ", fontsize=16)
ax[:set_ylabel]("z", fontsize=16)
#plt.savefig("foo.pdf")
plt.show()
In [10]:
ez = EpsteinZinBKY()
sv = StochasticVolatilityBKY()
Out[10]:
In [11]:
σ_vals, z_vals, W = compute_fp_by(ez, sv, I=I, J=J, L=L);
In [12]:
fig, ax = plt.subplots(figsize=(10, 5.7))
cs1 = ax[:contourf](σ_vals,
z_vals,
W',
alpha=0.6)
#levels=lvs,
ctr1 = ax[:contour](σ_vals,
z_vals,
W')
plt.clabel(ctr1, inline=1, fontsize=13)
plt.colorbar(cs1, ax=ax)
ax[:set_title]("Utility")
ax[:set_xlabel]("σ", fontsize=16)
ax[:set_ylabel]("z", fontsize=16)
#plt.savefig("foo.pdf")
plt.show()
In [13]:
fig = figure(figsize=(8,6))
ax = fig[:gca](projection="3d")
ax[:view_init](40, 230)
xgrid, ygrid = meshgrid(σ_vals, z_vals)
ctr1 = ax[:plot_surface](xgrid,
ygrid,
cmap=ColorMap("jet"),
alpha=0.7,
rstride=1, cstride=1,
linewidth=0.5,
W')
#plt.clabel(ctr1, inline=1, fontsize=13)
#plt.colorbar(ctr1, ax=ax)
ax[:set_zlabel]("V", labelpad=10)
ax[:set_xlabel]("σ", labelpad=10, fontsize=14)
ax[:set_ylabel]("z", labelpad=10, fontsize=12)
#plt.savefig("foo.pdf")
plt.show()
In [ ]: