| 1 |
// Simple test of shock_paths with perfect_foresight_with_expectation_errors_{setup,solver} |
| 2 |
|
| 3 |
var c k; |
| 4 |
varexo x; |
| 5 |
|
| 6 |
parameters alph gam delt bet aa; |
| 7 |
alph=0.5; |
| 8 |
gam=0.5; |
| 9 |
delt=0.02; |
| 10 |
bet=0.05; |
| 11 |
aa=0.5; |
| 12 |
|
| 13 |
|
| 14 |
model; |
| 15 |
c + k - aa*x*k(-1)^alph - (1-delt)*k(-1); |
| 16 |
c^(-gam) - (1+bet)^(-1)*(aa*alph*x(+1)*k^(alph-1) + 1 - delt)*c(+1)^(-gam); |
| 17 |
end; |
| 18 |
|
| 19 |
initval; |
| 20 |
x = 1; |
| 21 |
k = ((delt+bet)/(1.0*aa*alph))^(1/(alph-1)); |
| 22 |
c = aa*k^alph-delt*k; |
| 23 |
end; |
| 24 |
|
| 25 |
steady; |
| 26 |
|
| 27 |
check; |
| 28 |
|
| 29 |
shock_paths; |
| 30 |
var x; |
| 31 |
periods 2018Y, 2019Y, 2020Y:end; |
| 32 |
values 1.2, self.x(-1) + 0.01, initval.x + 0.02; |
| 33 |
end; |
| 34 |
|
| 35 |
shock_paths(learnt_in = 2); |
| 36 |
var x; |
| 37 |
periods 2019Y; |
| 38 |
values prev.x + 0.03; |
| 39 |
end; |
| 40 |
|
| 41 |
shock_paths(learnt_in = 2024Y); |
| 42 |
var x; |
| 43 |
periods 2026Y, 2027Y:end; |
| 44 |
values learnt_in(2019Y).x(+1) + 0.04, learnt_in(2018Y).x(-8); |
| 45 |
end; |
| 46 |
|
| 47 |
perfect_foresight_with_expectation_errors_setup(periods=200, first_simulation_period = 2018Y); |
| 48 |
perfect_foresight_with_expectation_errors_solver; |
| 49 |
|
| 50 |
assert(oo_.exo_simul(3) == 1.2 + 0.01 + 0.03) |
| 51 |
assert(all(oo_.exo_simul(4:9) == 1 + 0.02)) |
| 52 |
assert(oo_.exo_simul(10) == 1 + 0.02 + 0.04) |
| 53 |
assert(oo_.exo_simul(11) == 1.2 + 0.01) |
| 54 |
assert(all(oo_.exo_simul(12:202) == 1 + 0.02)) |