Debian Codegraph @

tests/optimal_policy/nk_ramsey_expectation_a.mod

raw
1 //MODEL:
2 // test for using expectation operator with Ramsey policy
3 // Here, the expected variable is replaced manually with an auxiliary variable (epai)
4 // We check that the result is the same as with an explicit expectation operator in nk_ramsey_expectation.mod
5 // Note that the example doesn't make any sense from an economic point of view.
6
7 //------------------------------------------------------------------------------------------------------------------------
8 //1. Variable declaration
9 //------------------------------------------------------------------------------------------------------------------------
10
11 var pai, c, n, r, a, epai;
12
13 //4 variables + 1 shock
14
15 varexo u;
16
17
18
19
20 //------------------------------------------------------------------------------------------------------------------------
21 // 2. Parameter declaration and calibration
22 //-------------------------------------------------------------------------------------------------------------------------
23
24 parameters beta, rho, epsilon, omega, phi, gamma;
25
26 beta=0.99;
27 gamma=3; //Frish elasticity
28 omega=17; //price stickyness
29 epsilon=8; //elasticity for each variety of consumption
30 phi=1; //coefficient associated to labor effort disutility
31
32 rho=0.95; //coefficient associated to productivity shock
33
34
35 //-----------------------------------------------------------------------------------------------------------------------
36 // 3. The model
37 //-----------------------------------------------------------------------------------------------------------------------
38
39
40 model;
41
42
43 a=rho*(a(-1))+u;
44
45 1/c=beta*(1/(c(+1)))*(r/epai); //euler
46
47
48 omega*pai*(pai-1)=beta*omega*(c/(c(+1)))*(pai(+1))*(pai(+1)-1)+epsilon*exp(a)*n*(c/exp(a)*phi*n^gamma-(epsilon-1)/epsilon); //NK pc
49 //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); //NK pc
50
51 (exp(a))*n=c+(omega/2)*((pai-1)^2);
52
53 epai = pai(+1);
54 end;
55
56 //--------------------------------------------------------------------------------------------------------------------------
57 // 4. Steady state
58 //---------------------------------------------------------------------------------------------------------------------------
59
60 initval;
61 % this is the exact steady state under optimal policy
62 %important for the comparison
63
64 pai=1;
65 epai=1;
66 r=1/beta;
67 c=((epsilon-1)/(epsilon*phi))^(1/(1+gamma));
68 n=c;
69 a=0;
70
71
72 end;
73
74
75
76 //---------------------------------------------------------------------------------------------------------------------------
77 // 5. shocks
78 //---------------------------------------------------------------------------------------------------------------------------
79
80 shocks;
81 var u; stderr 0.008;
82
83 end;
84
85 //--------------------------------------------------------------------------------------------------------------------------
86 // 6. Ramsey problem
87 //--------------------------------------------------------------------------------------------------------------------------
88
89 planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
90
91 options_.solve_tolf=1e-12;
92 ramsey_model(planner_discount=0.99);
93 stoch_simul(order=1,irf=0);
94 evaluate_planner_objective;
95
96 o1=load(['nk_ramsey_expectation' filesep 'Output' filesep 'nk_ramsey_expectation_results']);
97 if (norm(o1.oo_.dr.ghx-oo_.dr.ghx,inf) > 1e-12)
98 error('ghx doesn''t match')
99 end
100 if (norm(o1.oo_.dr.ghu-oo_.dr.ghu,inf) > 1e-12)
101 error('ghu doesn''t match')
102 end
103 if (abs(o1.oo_.planner_objective_value.conditional.zero_initial_multiplier-oo_.planner_objective_value.conditional.zero_initial_multiplier) > 1e-12 ...
104 || abs(o1.oo_.planner_objective_value.conditional.steady_initial_multiplier-oo_.planner_objective_value.conditional.steady_initial_multiplier) > 1e-12 ...
105 || abs(o1.oo_.planner_objective_value.unconditional-oo_.planner_objective_value.unconditional) > 1e-12)
106 error('planner objective value doesn''t match')
107 end
108