Debian Codegraph @

tests/deterministic_simulations/linear_state_space_arma_condpaths.mod

raw
1 % Tests perfect simulation of linear model (sim1_linear.m) with controlled paths
2 %
3 % In particular, the endo and exo flipped (z vs u) have a nonzero steady state,
4 % to verify that this case is correctly handled.
5
6 var x
7 y
8 z;
9
10 varexo u
11 v;
12
13 parameters a1 a2 a3 a4
14 b1 b2 b3
15 c1;
16
17 a1 = .50;
18 a2 = .00;
19 a3 = .70;
20 a4 = .40;
21 b1 = .90;
22 b2 = .00;
23 b3 = .80;
24 c1 = .95;
25
26
27 model(linear);
28 y = a1*x(-1) + a2*x(+1) + a3*z + a4*y(-1);
29 z = 0.5 + b1*z(-1) + b2*z(+1) + b3*x + u;
30 x = c1*x(-1) + v +v(-1)+v(+1);
31 end;
32
33 initval;
34 y=-1;
35 x=-1;
36 z=-1;
37 end;
38
39 endval;
40 y=0;
41 x=0;
42 z=0;
43 u=0.1;
44 end;
45
46 steady;
47
48 perfect_foresight_controlled_paths;
49 exogenize z;
50 periods 50;
51 values 0.5;
52 endogenize u;
53
54 // Regression test: add a 2nd endogeneized variable in the same period
55 exogenize x;
56 periods 50;
57 values 0.2;
58 endogenize v;
59 end;
60
61 perfect_foresight_setup(periods=100);
62 perfect_foresight_solver;
63
64 if ~oo_.deterministic_simulation.status
65 error('Perfect foresight simulation failed')
66 end
67
68 if ~(oo_.endo_simul(3, 51) == 0.5 && isequal(find(oo_.exo_simul(:,1) ~= 0.1), [1; 51]) ...
69 && oo_.endo_simul(1, 51) == 0.2)
70 error('Linear perfect foresight simulation with controlled paths failed')
71 end