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