| 1 |
/* Tests the correctness of the Ramsey command when used together with a steady state file by |
| 2 |
* checking whether the results coincide with the ones when used with an initval block |
| 3 |
* |
| 4 |
* The example is taken from Juillard, Michel (2011): User manual for optimal policy package, |
| 5 |
* MONFISPOL FP7 project SSH-225149, Deliverable 1.1.2 |
| 6 |
*/ |
| 7 |
|
| 8 |
var pai, c, n, r, a; |
| 9 |
varexo u; |
| 10 |
parameters beta, rho, epsilon, omega, phi, gamma; |
| 11 |
|
| 12 |
beta=0.99; |
| 13 |
gamma=3; |
| 14 |
omega=17; |
| 15 |
epsilon=8; |
| 16 |
phi=1; |
| 17 |
rho=0.95; |
| 18 |
|
| 19 |
model; |
| 20 |
a = rho*a(-1)+u; |
| 21 |
1/c = beta*r/(c(+1)*pai(+1)); |
| 22 |
pai*(pai-1)/c = beta*pai(+1)*(pai(+1)-1)/c(+1)+epsilon*phi*n^(gamma+1)/omega -exp(a)*n*(epsilon-1)/(omega*c); |
| 23 |
exp(a)*n = c+(omega/2)*(pai-1)^2; |
| 24 |
end; |
| 25 |
|
| 26 |
initval; |
| 27 |
r=1; |
| 28 |
end; |
| 29 |
|
| 30 |
steady_state_model; |
| 31 |
a = 0; |
| 32 |
pai = beta*r; |
| 33 |
c = find_c(0.96,pai,beta,epsilon,phi,gamma,omega); |
| 34 |
n = c+(omega/2)*(pai-1)^2; |
| 35 |
end; |
| 36 |
|
| 37 |
shocks; |
| 38 |
var u; stderr 0.008; |
| 39 |
end; |
| 40 |
|
| 41 |
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma))); |
| 42 |
ramsey_model(planner_discount=0.99,instruments=(r)); |
| 43 |
steady; |
| 44 |
stoch_simul(order=1, nograph); |
| 45 |
evaluate_planner_objective; |
| 46 |
|
| 47 |
benchmark=load('ramsey_ex_initval/Output/ramsey_ex_initval_results.mat'); |
| 48 |
|
| 49 |
if any( [ max(abs((benchmark.oo_.steady_state-oo_.steady_state)))>1e-5, ... |
| 50 |
max(abs(benchmark.oo_.dr.ys-oo_.dr.ys))>1e-5, ... |
| 51 |
max(max(abs(benchmark.oo_.dr.ghx-oo_.dr.ghx)))>1e-5, ... |
| 52 |
max(max(abs(benchmark.oo_.dr.ghu-oo_.dr.ghu)))>1e-5, ... |
| 53 |
max(max(abs(benchmark.oo_.dr.Gy-oo_.dr.Gy)))>1e-5, ... |
| 54 |
abs(benchmark.oo_.planner_objective_value.unconditional-oo_.planner_objective_value.unconditional)>1e-5, ... |
| 55 |
abs(benchmark.oo_.planner_objective_value.conditional.zero_initial_multiplier-oo_.planner_objective_value.conditional.zero_initial_multiplier)>1e-5, ... |
| 56 |
abs(benchmark.oo_.planner_objective_value.conditional.steady_initial_multiplier-oo_.planner_objective_value.conditional.steady_initial_multiplier)>1e-5] ) |
| 57 |
error('Initval and steady state file yield different results') |
| 58 |
end |