1// Test USE_DLL option at order 2
2
3var y, c, k, a, h, b;
4varexo e, u;
5
6parameters beta, rho, alpha, delta, theta, psi, tau;
7
8alpha = 0.36;
9rho   = 0.95;
10tau   = 0.025;
11beta  = 0.99;
12delta = 0.025;
13psi   = 0;
14theta = 2.95;
15
16phi   = 0.1;
17
18model(use_dll);
19c*theta*h^(1+psi)=(1-alpha)*y;
20k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
21    *(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
22y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
23k = exp(b)*(y-c)+(1-delta)*k(-1);
24a = rho*a(-1)+tau*b(-1) + e;
25b = tau*a(-1)+rho*b(-1) + u;
26end;
27
28initval;
29y = 1.08068253095672;
30c = 0.80359242014163;
31h = 0.29175631001732;
32k = 11.08360443260358;
33a = 0;
34b = 0;
35e = 0;
36u = 0;
37end;
38
39shocks;
40var e; stderr 0.009;
41var u; stderr 0.009;
42var e, u = phi*0.009*0.009;
43end;
44
45stoch_simul(nograph);
46
47if ~exist('example1_results.mat','file');
48   error('example1 must be run first');
49end;
50
51oo1 = load('example1_results','oo_');
52
53dr0 = oo1.oo_.dr;
54dr = oo_.dr;
55
56if max(max(abs(dr0.ghx - dr.ghx))) > 1e-12;
57   error('error in ghx');
58end;
59if max(max(abs(dr0.ghu - dr.ghu))) > 1e-12;
60   error('error in ghu');
61end;
62if max(max(abs(dr0.ghxx - dr.ghxx))) > 1e-12;
63   error('error in ghxx');
64end;
65if max(max(abs(dr0.ghuu - dr.ghuu))) > 1e-12;
66   error('error in ghuu');
67end;
68if max(max(abs(dr0.ghxu - dr.ghxu))) > 1e-12;
69   error('error in ghxu');
70end;
71if max(max(abs(dr0.ghs2 - dr.ghs2))) > 1e-12;
72   error('error in ghs2');
73end;
74