Stability in the Linear Time Trend Model

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")


WARNING: replacing docs for 'EpsteinZin :: Union{}' in module 'Main'.
WARNING: replacing docs for 'EpsteinZin :: Tuple{Any,Any,Any}' in module 'Main'.
WARNING: replacing docs for 'EpsteinZinBY :: Tuple{}' in module 'Main'.
WARNING: replacing docs for 'EpsteinZinBKY :: Tuple{}' in module 'Main'.
WARNING: replacing docs for 'EpsteinZinSSY :: Tuple{}' in module 'Main'.
LoadError: UndefVarError: MarkovChain not defined
while loading /home/john/sync_dir/papers/recursive_utility/code/src/tallarini_discretized.jl, in expression starting on line 521

Stacktrace:
 [1] include_from_node1(::String) at ./loading.jl:569
 [2] include(::String) at ./sysimg.jl:14
 [3] include_string(::String, ::String) at ./loading.jl:515

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]:
compute_spec_rad_ltt (generic function with 1 method)

Experiments with some common parameterizations


In [3]:
compute_spec_rad_ltt(γ=10, ψ=0.1)


Out[3]:
(0.8269175092971591, 1.0)

Spectral Radius Plots


In [9]:
using PyPlot
plt = PyPlot


Out[9]:
PyPlot

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 [ ]: