Debian Codegraph @

tests/kalman_filter_smoother/gen_data.mod

raw
1 var w x y z dw dx dy;
2 varexo e_w e_x e_y e_z;
3
4 parameters rho_w rho_x rho_y rho_z a1 a2 a3 b c;
5
6 rho_w = 0.5;
7 rho_x = 0.5;
8 rho_y = 0.5;
9 rho_z = 0.8;
10
11 a1 = 0.1;
12 a2 = -0.1;
13 a3 = 0.1;
14 b = 1;
15 c = 1;
16
17 model(linear);
18 dw = rho_w*dw(-1)+a1*(x(-1)-b*y(-1)-c*w(-1))+e_w;
19 dx = rho_x*dx(-1)+a2*(x(-1)-b*y(-1)-c*w(-1))+e_x;
20 dy = rho_y*dy(-1)+a3*(x(-1)-b*y(-1))+e_y;
21 z = rho_z*z(-1)+dw-dx+e_z;
22 w = w(-1)+dw;
23 x = x(-1)+dx;
24 y = y(-1)+dy;
25 end;
26
27 shocks;
28 var e_w; stderr 0.05;
29 var e_x; stderr 0.05;
30 var e_y; stderr 0.05;
31 var e_z; stderr 0.05;
32 end;
33
34 stoch_simul(periods=2000,irf=0);
35
36 verbatim;
37 w=oo_.endo_simul(strmatch('w',M_.endo_names,'exact'),:)';
38 x=oo_.endo_simul(strmatch('x',M_.endo_names,'exact'),:)';
39 y=oo_.endo_simul(strmatch('y',M_.endo_names,'exact'),:)';
40 z=oo_.endo_simul(strmatch('z',M_.endo_names,'exact'),:)';
41 dw=oo_.endo_simul(strmatch('dw',M_.endo_names,'exact'),:)';
42 dx=oo_.endo_simul(strmatch('dx',M_.endo_names,'exact'),:)';
43 dy=oo_.endo_simul(strmatch('dy',M_.endo_names,'exact'),:)';
44 end;
45
46 plot([w x y z]);
47
48 save data_algo.mat w x y z dw dx dy;