Stability for the model where
$$ \mathbf K_{ij} = \beta^\theta \exp [ (1-\gamma) (\mu + x_j - x_i)] \mathbf Q_{ij} $$
In [1]:
include("src/ez_model.jl")
include("src/tallarini_discretized.jl")
In [2]:
function compute_spec_rad_ltt(;ψ=1.5,
γ=2.5,
β=0.99,
ρ=0.91,
b=0.0,
σ=0.0343,
μ=0.02,
M=10)
ez = EpsteinZin(ψ=ψ, γ=γ, β=β)
ar1 = AR1(ρ=ρ, b=b, σ=σ)
K = compute_K_ltt(ez, ar1, μ, M)
return compute_spec_rad(K), ez.θ
end
Out[2]:
In [3]:
compute_spec_rad_ltt(γ=10, ψ=0.1)
Out[3]:
In [9]:
using PyPlot
plt = PyPlot
Out[9]:
In [ ]:
J = 20 # grid size
x_vals = linspace(1/0.3, 1/0.7, J) # psi
y_vals = linspace(0.98, 0.995, J) # beta
R = Array{Float64}(J, J)
In [ ]:
for (i, ψ) in enumerate(x_vals)
for (j, β) in enumerate(y_vals)
R[i, j], θ = compute_spec_rad_ltt(ψ=ψ, β=β, γ=11)
@assert θ < 0 "Detected non-negative theta value"
end
end
In [10]:
fig, ax = plt.subplots(figsize=(10, 5.7))
xgrid = repmat(x_vals', J, 1 )
ygrid = repmat(y_vals, 1, J )
#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)
plt.savefig("foo.pdf")
plt.show()
In [ ]:
In [ ]: