Debian Codegraph @

tests/pac/trend-component-31/example1.mod

raw
1 // --+ options: json=compute, stochastic +--
2
3 // Regression test for bug preprocessor#52
4
5 var x1 x2 x1bar x2bar z ;
6
7 varexo ex1 ex2 ex1bar ex2bar ez ;
8
9 parameters a_x1_0 a_x1_1 a_x1_2 a_x1_x2_1 a_x1_x2_2
10 a_x2_0 a_x2_1 a_x2_2 a_x2_x1_1 a_x2_x1_2
11 e_c_m c_z_1 c_z_2 gamma beta ;
12
13 a_x1_0 = -.9;
14 a_x1_1 = .4;
15 a_x1_2 = .3;
16 a_x1_x2_1 = .1;
17 a_x1_x2_2 = .2;
18
19
20 a_x2_0 = -.9;
21 a_x2_1 = .2;
22 a_x2_2 = -.1;
23 a_x2_x1_1 = -.1;
24 a_x2_x1_2 = .2;
25
26 beta = .2;
27 e_c_m = .5;
28 c_z_1 = .2;
29 c_z_2 = -.1;
30
31 gamma = .7;
32
33 trend_component_model(model_name=toto, eqtags=['eq:x1', 'eq:x2', 'eq:x1bar', 'eq:x2bar'], targets=['eq:x1bar', 'eq:x2bar']);
34
35 pac_model(auxiliary_model_name=toto, discount=beta, model_name=pacman);
36
37 model;
38
39 [name='eq:x1']
40 diff(x1) = a_x1_0*(x1(-1)-x1bar(-1)) + a_x1_1*diff(x1(-1)) + a_x1_2*diff(x1(-2)) + + a_x1_x2_1*diff(x2(-1)) + a_x1_x2_2*diff(x2(-2)) + ex1;
41
42 [name='eq:x2']
43 diff(x2) = a_x2_0*(x2(-1)-x2bar(-1)) + a_x2_1*diff(x1(-1)) + a_x2_2*diff(x1(-2)) + + a_x2_x1_1*diff(x2(-1)) + a_x2_x1_2*diff(x2(-2)) + ex2;
44
45 [name='eq:x1bar']
46 x1bar = x1bar(-1) + ex1bar;
47
48 [name='eq:x2bar']
49 x2bar = x2bar(-1) + ex2bar;
50
51 [name='eq:pac']
52 diff(z) = gamma*(e_c_m*(x1(-1)-z(-1)) + pac_expectation(pacman)) + (1-gamma)*ez;
53
54 end;
55
56 shocks;
57 var ex1 = 1.0;
58 var ex2 = 1.0;
59 var ex1bar = 1.0;
60 var ex2bar = 1.0;
61 var ez = 1.0;
62 end;
63
64 // Initialize the PAC model (build the Companion VAR representation for the auxiliary model).
65 pac.initialize('pacman');
66
67 // Update the parameters of the PAC expectation model (h0 and h1 vectors).
68 pac.update.expectation('pacman');
69
70 // Set initial conditions to zero. Please use more sensible values if any...
71 initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names));
72
73 // Simulate the model for 500 periods
74 TrueData = simul_backward_model(initialconditions, 500);