2015-08-12 18:37:41 +02:00
|
|
|
|
# Modification of the path (for packages). Should be done in ~/.juliarc.jl with a fixed path instead.
|
2015-08-17 12:29:59 +02:00
|
|
|
|
if isempty(findin([abspath("../../../julia")], LOAD_PATH))
|
|
|
|
|
unshift!(LOAD_PATH, abspath("../../../julia"))
|
|
|
|
|
end
|
2015-08-12 18:37:41 +02:00
|
|
|
|
|
2018-03-10 15:09:36 +01:00
|
|
|
|
using Dynare
|
|
|
|
|
using SteadyState
|
2015-08-12 18:37:41 +02:00
|
|
|
|
|
2016-05-19 12:26:08 +02:00
|
|
|
|
|
2018-03-10 15:09:36 +01:00
|
|
|
|
# Compile the rbc.mod file -> produce a module with the model definition.
|
2016-05-19 16:34:47 +02:00
|
|
|
|
@dynare "rbc1.mod"
|
2016-05-19 12:26:08 +02:00
|
|
|
|
|
2016-06-13 11:58:43 +02:00
|
|
|
|
# First call to the steady state routine (analytical)
|
|
|
|
|
@time SteadyState.steady!(model_, oo_)
|
|
|
|
|
|
|
|
|
|
# First call to the steady state routine (analytical)
|
|
|
|
|
@time SteadyState.steady!(model_, oo_)
|
|
|
|
|
|
2018-03-10 15:09:36 +01:00
|
|
|
|
steadyState = deepcopy(oo_.steady_state)
|
2016-06-13 11:58:43 +02:00
|
|
|
|
|
2018-03-10 15:09:36 +01:00
|
|
|
|
y_init = copy(steadyState)
|
|
|
|
|
y_init[1] = 1.1*steadyState[1]
|
|
|
|
|
y_init[2] = 0.9*steadyState[2]
|
2016-06-13 11:58:43 +02:00
|
|
|
|
|
|
|
|
|
# First call to the steady state routine (numerical)
|
|
|
|
|
println("First call to the numerical steady state routine")
|
2018-03-10 15:09:36 +01:00
|
|
|
|
@time SteadyState.steady!(model_, oo_, y_init)
|
2016-06-13 11:58:43 +02:00
|
|
|
|
|
|
|
|
|
# Check results
|
2018-03-10 15:09:36 +01:00
|
|
|
|
@assert maximum(abs.(oo_.steady_state-steadyState))<1e-6
|
2016-06-13 11:58:43 +02:00
|
|
|
|
|
2018-03-10 15:09:36 +01:00
|
|
|
|
yinit = deepcopy(steadyState)
|
|
|
|
|
yinit[1] = 1.1*steadyState[1]
|
|
|
|
|
yinit[2] = 0.9*steadyState[2]
|
2016-06-13 11:58:43 +02:00
|
|
|
|
|
|
|
|
|
# Second call to the steady state routine (numerical)
|
|
|
|
|
println("Second call to the numerical steady state routine")
|
|
|
|
|
@time SteadyState.steady!(model_, oo_, yinit)
|
|
|
|
|
|
2018-03-10 15:09:36 +01:00
|
|
|
|
params = model_.params
|
|
|
|
|
|
2016-06-13 11:58:43 +02:00
|
|
|
|
# change alpha
|
|
|
|
|
println("Change α")
|
2018-03-10 15:09:36 +01:00
|
|
|
|
model_.params = deepcopy(params)
|
|
|
|
|
model_.params[4] = max(min(1.0, params[4]*1.1), 0.0)
|
|
|
|
|
@time ys = SteadyState.steady(model_, oo_) # Analytical steady state
|
|
|
|
|
@time SteadyState.steady!(model_, oo_, steadyState)
|
|
|
|
|
@assert maximum(abs.(oo_.steady_state-ys))<1e-6
|
2016-06-13 11:58:43 +02:00
|
|
|
|
|
|
|
|
|
# change delta
|
|
|
|
|
println("Change δ")
|
2018-03-10 15:09:36 +01:00
|
|
|
|
model_.params = deepcopy(params)
|
|
|
|
|
model_.params[6] = max(min(1.0, params[6]*1.1), 0.0)
|
|
|
|
|
@time ys = SteadyState.steady(model_, oo_) # Analytical steady state
|
|
|
|
|
@time SteadyState.steady!(model_, oo_, steadyState)
|
|
|
|
|
@assert maximum(abs.(oo_.steady_state-ys))<1e-6
|
2016-06-13 11:58:43 +02:00
|
|
|
|
|
|
|
|
|
# change beta
|
|
|
|
|
println("Change β")
|
2018-03-10 15:09:36 +01:00
|
|
|
|
model_.params = deepcopy(params)
|
|
|
|
|
model_.params[1] = max(min(1-1e-6, params[1]*0.99), 0.0)
|
|
|
|
|
@time ys = SteadyState.steady(model_, oo_) # Analytical steady state
|
|
|
|
|
@time SteadyState.steady!(model_, oo_, steadyState)
|
|
|
|
|
@assert maximum(abs.(oo_.steady_state-ys))<1e-6
|
2016-06-13 11:58:43 +02:00
|
|
|
|
|
|
|
|
|
# change tau
|
|
|
|
|
println("Change τ")
|
2018-03-10 15:09:36 +01:00
|
|
|
|
model_.params = deepcopy(params)
|
|
|
|
|
model_.params[3] = params[3]/1.1
|
|
|
|
|
@time ys = SteadyState.steady(model_, oo_)
|
|
|
|
|
@time SteadyState.steady!(model_, oo_, steadyState)
|
|
|
|
|
@assert maximum(abs.(oo_.steady_state-ys))<1e-6
|
2016-06-13 11:58:43 +02:00
|
|
|
|
|
|
|
|
|
# change Epsilon
|
|
|
|
|
println("Change ϵ")
|
2018-03-10 15:09:36 +01:00
|
|
|
|
model_.params = deepcopy(params)
|
|
|
|
|
model_.params[5] = params[5]*1.1
|
|
|
|
|
@time ys = SteadyState.steady(model_, oo_)
|
|
|
|
|
@time SteadyState.steady!(model_, oo_, steadyState)
|
|
|
|
|
@assert maximum(abs.(oo_.steady_state-ys))<1e-6
|