Debian Codegraph @

tests/stochastic_simulations/example2long.mod

raw
1 var y, c, k, a, h, b, w;
2 varexo e, u;
3
4 parameters beta, rho, alpha, delta, theta, psi, tau;
5
6 alpha = 0.36;
7 rho = 0.95;
8 tau = 0.025;
9 beta = 0.99;
10 delta = 0.025;
11 psi = 0;
12 theta = 2.95;
13
14 phi = 0.1;
15
16 model;
17 c*theta*h^(1+psi)=(1-alpha)*y;
18 k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
19 *(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
20 y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
21 k = exp(b)*(y-c)+(1-delta)*k(-1);
22 a = rho*a(-1)+tau*b(-1) + e;
23 b = tau*a(-1)+rho*b(-1) + u;
24 w = y
25 @#for i in 1:50
26 + beta*(y(@{i})
27 @#endfor
28 @#for i in 1:50
29 )
30 @#endfor
31 ;
32 end;
33
34 initval;
35 y = 1.08068253095672;
36 c = 0.80359242014163;
37 h = 0.29175631001732;
38 k = 11.08360443260358;
39 w = y*(1-beta^51)/(1-beta);
40 a = 0;
41 b = 0;
42 e = 0;
43 u = 0;
44 end;
45
46 shocks;
47 var e; stderr 0.009;
48 var u; stderr 0.009;
49 var e, u = phi*0.009*0.009;
50 end;
51
52 stoch_simul;
53
54 if ~isfile('example1long/Output/example1long_results.mat')
55 error('example1long must be run first');
56 end;
57
58 oo1 = load(['example1long' filesep 'Output' filesep 'example1long_results'],'oo_');
59
60 dr0 = oo1.oo_.dr;
61 dr = oo_.dr;
62
63 d_ghx = max(abs(dr0.ghx(:) - dr.ghx(:)));
64 d_ghu = max(abs(dr0.ghu(:) - dr.ghu(:)));
65 d_ghxx = max(abs(dr0.ghxx(:) - dr.ghxx(:)));
66 d_ghxu = max(abs(dr0.ghxu(:) - dr.ghxu(:)));
67 d_ghuu = max(abs(dr0.ghuu(:) - dr.ghuu(:)));
68 d_ghs2 = max(abs(dr0.ghs2 - dr.ghs2));
69
70 skipline()
71 disp(sprintf('ghx max. abs. diff. is %s.', num2str(d_ghx)))
72 disp(sprintf('ghu max. abs. diff. is %s.', num2str(d_ghu)))
73 disp(sprintf('ghxx max. abs. diff. is %s.', num2str(d_ghxx)))
74 disp(sprintf('ghxu max. abs. diff. is %s.', num2str(d_ghxu)))
75 disp(sprintf('ghuu max. abs. diff. is %s.', num2str(d_ghuu)))
76 disp(sprintf('ghs2 max. abs. diff. is %s.', num2str(d_ghs2)))
77 skipline()
78
79 epsilon = 1e-12;
80
81 if d_ghx>epsilon
82 error('error in ghx')
83 end
84
85 if d_ghu>epsilon
86 error('error in ghu')
87 end
88
89 if d_ghxx>epsilon
90 error('error in ghxx')
91 end
92
93 if d_ghxu>epsilon
94 error('error in ghxu')
95 end
96
97 if d_ghuu>epsilon
98 error('error in ghuu')
99 end
100
101 if d_ghs2>epsilon
102 error('error in ghs2')
103 end