In [2]:
include("src/utilities.jl")
include("src/ez_model.jl")
include("src/ssy_discretized.jl")
Out[2]:
In [3]:
using PyPlot
plt = PyPlot
Out[3]:
In [6]:
J = 20 # grid size
R = Array{Float64}(J, J);
In [7]:
x_vals = linspace(1.25, 2.25, J) # ψ
y_vals = linspace(0.0005, 0.008, J) # μ`
Out[7]:
In [8]:
for (i, x) in enumerate(x_vals)
for (j, y) in enumerate(y_vals)
ez = EpsteinZinSSY(ψ=x)
@assert ez.θ < 0 "Detected non-negative theta value"
K = compute_K_ssy(ez, ssy, μ=y)
R[i, j] = compute_spec_rad(K)
end
end
In [9]:
ez = EpsteinZinSSY() # Get a fresh copy
μ=0.0016
Out[9]:
In [10]:
ez.ψ
Out[10]:
In [11]:
fig, ax = plt.subplots(figsize=(10, 5.7))
cs1 = ax[:contourf](x_vals,
y_vals,
R',
alpha=0.6)
#levels=lvs,
ctr1 = ax[:contour](x_vals,
y_vals,
R',
levels=[1.0])
plt.clabel(ctr1, inline=1, fontsize=13)
plt.colorbar(cs1, ax=ax)
ax[:set_title]("Spectral radius")
ax[:set_xlabel]("ψ", fontsize=16)
ax[:set_ylabel]("μ", fontsize=16)
ax[:annotate]("Schorfheide, Song and Yaron ",
xy=(ez.ψ - 0.024, μ - 0.0001),
xycoords="data",
xytext=(-225, 30),
textcoords="offset points",
fontsize=12,
arrowprops=Dict("arrowstyle" => "->"))
ax[:plot]([ez.ψ], [μ], "ko", alpha=0.6)
plt.savefig("ssy_pm.pdf")
plt.show()
In [12]:
x_vals = linspace(4.0, 12.0, J) # γ
y_vals = linspace(0.0005, 0.006, J) # μ
Out[12]:
In [13]:
for (i, x) in enumerate(x_vals)
for (j, y) in enumerate(y_vals)
ez = EpsteinZinSSY(γ=x)
@assert ez.θ < 0 "Detected non-negative theta value"
K = compute_K_ssy(ez, ssy, μ=y)
R[i, j] = compute_spec_rad(K)
end
end
In [14]:
ez = EpsteinZinSSY() # Get a fresh copy
μ=0.0016
Out[14]:
In [15]:
ez.γ
Out[15]:
In [16]:
fig, ax = plt.subplots(figsize=(10, 5.7))
#lvs = [0.0, 0.8, 1.0, 1.4, 1.8, 2.2, 4.4]
#cls = [cm.jet(i) for i in np.linspace(0.4, 1, len(lvs))]
cs1 = ax[:contourf](x_vals,
y_vals,
R',
alpha=0.6)
#levels=lvs,
ctr1 = ax[:contour](x_vals,
y_vals,
R',
levels=[1.0])
plt.clabel(ctr1, inline=1, fontsize=13)
plt.colorbar(cs1, ax=ax)
ax[:set_title]("Spectral radius")
ax[:set_xlabel]("γ", fontsize=16)
ax[:set_ylabel]("μ", fontsize=16)
ax[:annotate]("Schorfheide, Song and Yaron ",
xy=(ez.γ - 0.084, μ - 0.0001),
xycoords="data",
xytext=(-225, -30),
textcoords="offset points",
fontsize=12,
arrowprops=Dict("arrowstyle" => "->"))
ax[:plot]([ez.γ], [μ], "ko", alpha=0.6)
plt.savefig("ssy_gm.pdf")
plt.show()
In [200]:
x_vals = linspace(0.0015, 0.004, J) # sigma_bar
y_vals = linspace(0.0005, 0.005, J) # μ
Out[200]:
In [201]:
ssy = SSY_default()
Out[201]:
In [202]:
for (i, x) in enumerate(x_vals)
for (j, y) in enumerate(y_vals)
ez = EpsteinZinSSY()
ssy.σ_bar = x
@assert ez.θ < 0 "Detected non-negative theta value"
K = compute_K_ssy(ez, ssy, μ=y)
R[i, j] = compute_spec_rad(K)
end
end
In [203]:
ez = EpsteinZinSSY() # Get a fresh copy
μ=0.0016
ssy = SSY_default()
Out[203]:
In [204]:
ssy.σ_bar
Out[204]:
In [205]:
fig, ax = plt.subplots(figsize=(10, 5.7))
#lvs = [0.0, 0.8, 1.0, 1.4, 1.8, 2.2, 4.4]
#cls = [cm.jet(i) for i in np.linspace(0.4, 1, len(lvs))]
cs1 = ax[:contourf](x_vals,
y_vals,
R',
alpha=0.6)
#levels=lvs,
ctr1 = ax[:contour](x_vals,
y_vals,
R',
levels=[1.0])
plt.clabel(ctr1, inline=1, fontsize=13)
plt.colorbar(cs1, ax=ax)
ax[:set_title]("Spectral radius")
ax[:set_xlabel]("σ_bar", fontsize=16)
ax[:set_ylabel]("μ", fontsize=16)
ax[:annotate]("Schorfheide, Song and Yaron ",
xy=(ssy.σ_bar - 0.000084, μ - 0.0001),
xycoords="data",
xytext=(-175, -40),
textcoords="offset points",
fontsize=12,
arrowprops=Dict("arrowstyle" => "->"))
ax[:plot]([ssy.σ_bar], [μ], "ko", alpha=0.6)
plt.savefig("ssy_sbm.pdf")
plt.show()
In [5]:
J = 20 # grid size
R = Array{Float64}(J, J);
x_vals = linspace(0.985, 0.991, J) # ρ
y_vals = linspace(0.99, 0.996, J) # ρ_hz
for (i, x) in enumerate(x_vals)
for (j, y) in enumerate(y_vals)
ssy.ρ = x
ssy.ρ_hz = y
@assert ez.θ < 0 "Detected non-negative theta value"
K = compute_K_ssy(ez, ssy)
R[i, j] = compute_spec_rad(K)
end
end
fig, ax = plt.subplots(figsize=(10, 5.7))
#lvs = [0.0, 0.8, 1.0, 1.4, 1.8, 2.2, 4.4]
#cls = [cm.jet(i) for i in np.linspace(0.4, 1, len(lvs))]
cs1 = ax[:contourf](x_vals,
y_vals,
R',
alpha=0.6)
#levels=lvs,
ctr1 = ax[:contour](x_vals,
y_vals,
R',
levels=[1.0])
plt.clabel(ctr1, inline=1, fontsize=13)
plt.colorbar(cs1, ax=ax)
ax[:set_title]("Spectral radius")
ax[:set_xlabel]("ρ", fontsize=16)
ax[:set_ylabel]("ρ_hz", fontsize=16)
plt.show()
In [ ]: