Debian Codegraph @

tests/stochastic_simulations/example2long_use_dll.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(use_dll);
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
61 dr0 = oo1.oo_.dr;
62 dr = oo_.dr;
63
64 d_ghx = max(abs(dr0.ghx(:) - dr.ghx(:)));
65 d_ghu = max(abs(dr0.ghu(:) - dr.ghu(:)));
66 d_ghxx = max(abs(dr0.ghxx(:) - dr.ghxx(:)));
67 d_ghxu = max(abs(dr0.ghxu(:) - dr.ghxu(:)));
68 d_ghuu = max(abs(dr0.ghuu(:) - dr.ghuu(:)));
69 d_ghs2 = max(abs(dr0.ghs2 - dr.ghs2));
70
71 skipline()
72 disp(sprintf('ghx max. abs. diff. is %s.', num2str(d_ghx)))
73 disp(sprintf('ghu max. abs. diff. is %s.', num2str(d_ghu)))
74 disp(sprintf('ghxx max. abs. diff. is %s.', num2str(d_ghxx)))
75 disp(sprintf('ghxu max. abs. diff. is %s.', num2str(d_ghxu)))
76 disp(sprintf('ghuu max. abs. diff. is %s.', num2str(d_ghuu)))
77 disp(sprintf('ghs2 max. abs. diff. is %s.', num2str(d_ghs2)))
78 skipline()
79
80 epsilon = 1e-11;
81
82 if d_ghx>epsilon
83 error('error in ghx')
84 end
85
86 if d_ghu>epsilon
87 error('error in ghu')
88 end
89
90 if d_ghxx>epsilon
91 error('error in ghxx')
92 end
93
94 if d_ghxu>epsilon
95 error('error in ghxu')
96 end
97
98 if d_ghuu>epsilon
99 error('error in ghuu')
100 end
101
102 if d_ghs2>epsilon
103 error('error in ghs2')
104 end