Debian Codegraph @

tests/decision_rules/second_order/ds2.mod

raw
1 @#define countries = 1:2
2 @#define assets = 1:2
3 var
4 @#for c in countries
5 yk_@{c} yl_@{c} c_@{c}
6 @#endfor
7 a ze_1 r_1
8 ;
9
10 varexo
11 @#for c in countries
12 ek_@{c} el_@{c}
13 @#endfor
14 ;
15
16 parameters rho eta omega sig_k sig_l ykbar ylbar;
17
18 rho = 1;
19 psi = 0.7;
20 eta = 0.9;
21 g = 0.25;
22 ykbar = 1;
23 ylbar = 1;
24 cbar = ykbar+ylbar;
25 nu = 0.5;
26 omega = 0.75;
27 sig_k = 0.02;
28 sig_l = 0.01;
29 sig_m = 0;
30 betabar = omega*cbar^(-eta);
31
32
33 model;
34 @#for c in countries
35 yk_@{c} = log(ykbar) + sig_k*ek_@{c};
36 yl_@{c} = log(ylbar) + sig_l*el_@{c};
37 exp(c_@{c})^(eta-rho) = omega*exp(c_@{c}(+1))^(-rho)*r_1(+1);
38 @#endfor
39
40 a = a(-1)*r_1 + exp(yk_1) + exp(yl_1) - exp(c_1);
41 -a = -a(-1)*r_1 + exp(yk_2) + exp(yl_2) - exp(c_2);
42 // r_1+ze_1 = ze_1+exp(yk_1-ze_1(-1));
43 r_1 = exp(yk_1-ze_1(-1))+ze_1-ze_1;
44
45
46 end;
47
48 shocks;
49 @#for c in countries
50 var ek_@{c} = 1;
51 var el_@{c} = 1;
52 @#endfor
53 end;
54
55 initval;
56 @#for c in countries
57 yk_@{c} = log(ykbar);
58 yl_@{c} = log(ylbar);
59 c_@{c} = log(ykbar+ylbar);
60 @#endfor
61 r_1 = 1/betabar;
62 ze_1 = log(betabar)+yk_1;
63 end;
64
65 resid;
66 steady;
67 model_diagnostics;
68 check;
69 stoch_simul(order=2,irf=0);
70
71 o1 = load(['ds1' filesep 'Output' filesep 'ds1_results'],'oo_');
72 oo1 = o1.oo_.dr;
73 oo2 = oo_.dr;
74 if any(abs(oo1.ghxx-oo2.ghxx) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end;
75 if any(abs(oo1.ghuu-oo2.ghuu) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end;
76 if any(abs(oo1.ghxu-oo2.ghxu) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end;
77 if any(abs(oo1.ghs2-oo2.ghs2) > 1e-14);error('ds1 with missing variable doesn''t reproduce ds2');end;