| 1 |
// --+ options: json=compute, stochastic +-- |
| 2 |
|
| 3 |
var y x z v u w z1 z2 z3; |
| 4 |
|
| 5 |
varexo ex ey ez eu ew; |
| 6 |
|
| 7 |
parameters a_y_1 a_y_2 b_y_1 b_y_2 a_u_1 a_u_2 b_u_1 b_u_2 b_x_1 b_x_2 d_y; |
| 8 |
|
| 9 |
parameters beta e_c_m c_z_1 c_z_2; // PAC equation parameters |
| 10 |
|
| 11 |
a_y_1 = .2; |
| 12 |
a_y_2 = .3; |
| 13 |
b_y_1 = .1; |
| 14 |
b_y_2 = .4; |
| 15 |
a_u_1 = .2; |
| 16 |
a_u_2 = .3; |
| 17 |
b_u_1 = .1; |
| 18 |
b_u_2 = .4; |
| 19 |
b_x_1 = -.1; |
| 20 |
b_x_2 = -.2; |
| 21 |
d_y = .5; |
| 22 |
|
| 23 |
beta = .9; |
| 24 |
e_c_m = .1; |
| 25 |
c_z_1 = .7; |
| 26 |
c_z_2 = -.3; |
| 27 |
|
| 28 |
var_model(model_name=toto, structural, eqtags=['eq:x', 'eq:y']); |
| 29 |
|
| 30 |
pac_model(auxiliary_model_name=toto, discount=beta, model_name=pacman); |
| 31 |
|
| 32 |
pac_target_info(pacman); |
| 33 |
|
| 34 |
target v; |
| 35 |
auxname_target_nonstationary vns; |
| 36 |
|
| 37 |
component y; |
| 38 |
auxname pv_y_; |
| 39 |
kind ll; |
| 40 |
|
| 41 |
component x; |
| 42 |
auxname pv_dx_; |
| 43 |
growth diff(x(-1)); |
| 44 |
kind dl; |
| 45 |
|
| 46 |
end; |
| 47 |
|
| 48 |
model; |
| 49 |
|
| 50 |
[name='eq:u'] |
| 51 |
u = a_u_1*u(-1) + a_u_2*diff(x(-1)) + b_u_1*y(-2) + b_u_2*diff(x(-2)) + eu ; |
| 52 |
|
| 53 |
[name='eq:y'] |
| 54 |
y = a_y_1*y(-1) + a_y_2*diff(x(-1)) + b_y_1*y(-2) + b_y_2*diff(x(-2)) + ey ; |
| 55 |
|
| 56 |
[name='eq:x'] |
| 57 |
diff(x) = b_x_1*y(-2) + b_x_2*diff(x(-1)) + ex ; |
| 58 |
|
| 59 |
[name='eq:v'] |
| 60 |
v = x + d_y*y ; |
| 61 |
|
| 62 |
[name='eq:pac'] |
| 63 |
diff(z) = e_c_m*(pac_target_nonstationary(pacman)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(pacman) + ez; |
| 64 |
|
| 65 |
[name='eq:w'] |
| 66 |
diff(w) = -.1*w + ew ; |
| 67 |
|
| 68 |
[name='eq:z1'] |
| 69 |
z1 = z+y-x+u; |
| 70 |
|
| 71 |
[name='eq:z2'] |
| 72 |
z2 = z-y+x-u; |
| 73 |
|
| 74 |
[name='eq:z3'] |
| 75 |
z3 = u-diff(v); |
| 76 |
|
| 77 |
end; |
| 78 |
|
| 79 |
shocks; |
| 80 |
var ex = 1.0; |
| 81 |
var ey = 1.0; |
| 82 |
var ez = 1.0; |
| 83 |
var ew = 1.0; |
| 84 |
var eu = 1.0; |
| 85 |
end; |
| 86 |
|
| 87 |
// Initialize the PAC model (build the Companion VAR representation for the auxiliary model). |
| 88 |
pac.initialize('pacman'); |
| 89 |
|
| 90 |
// Update the parameters of the PAC expectation model (h0 and h1 vectors). |
| 91 |
pac.update.expectation('pacman'); |
| 92 |
|
| 93 |
// Select a subset of the equations and print the equations, the list of parameters, endogenous |
| 94 |
// variables and exogenous variables in .inc files under ./simulation-files folder. Note that |
| 95 |
// innovations ex1bar and ex2bar will not appear in the equations. |
| 96 |
verbatim; |
| 97 |
cherrypick('test2', 'simulation-files-2-a', {'eq:z1', 'eq:z2', 'eq:z3'}, true); |
| 98 |
cherrypick('test2', 'simulation-files-2-b', {'eq:pac', 'eq:x', 'eq:y'}, true); |
| 99 |
aggregate('toto2.mod', {}, '', 'simulation-files-2-a', 'simulation-files-2-b'); |
| 100 |
end; |