| 1 |
// --+ options: json=compute, stochastic +-- |
| 2 |
|
| 3 |
var x1 x2 x1bar x2bar z y x u v s; |
| 4 |
|
| 5 |
varexo ex1 |
| 6 |
ex2 |
| 7 |
ex1bar (used='estimationonly') |
| 8 |
ex2bar (used='estimationonly') |
| 9 |
ez |
| 10 |
ey |
| 11 |
ex |
| 12 |
eu |
| 13 |
ev |
| 14 |
es; |
| 15 |
|
| 16 |
parameters |
| 17 |
rho_1 rho_2 rho_3 rho_4 |
| 18 |
a_x1_0 a_x1_1 a_x1_2 a_x1_x2_1 a_x1_x2_2 |
| 19 |
a_x2_0 a_x2_1 a_x2_2 a_x2_x1_1 a_x2_x1_2 |
| 20 |
e_c_m c_z_1 c_z_2 c_z_dx2 c_z_u c_z_dv c_z_s cx cy beta |
| 21 |
lambda; |
| 22 |
|
| 23 |
rho_1 = .9; |
| 24 |
rho_2 = -.2; |
| 25 |
rho_3 = .4; |
| 26 |
rho_4 = -.3; |
| 27 |
|
| 28 |
|
| 29 |
a_x1_0 = -.9; |
| 30 |
a_x1_1 = .4; |
| 31 |
a_x1_2 = .3; |
| 32 |
a_x1_x2_1 = .1; |
| 33 |
a_x1_x2_2 = .2; |
| 34 |
|
| 35 |
a_x2_0 = -.9; |
| 36 |
a_x2_1 = .2; |
| 37 |
a_x2_2 = -.1; |
| 38 |
a_x2_x1_1 = -.1; |
| 39 |
a_x2_x1_2 = .2; |
| 40 |
|
| 41 |
beta = .2; |
| 42 |
e_c_m = .5; |
| 43 |
c_z_1 = .2; |
| 44 |
c_z_2 = -.1; |
| 45 |
c_z_dx2 = .3; |
| 46 |
c_z_u = .3; |
| 47 |
c_z_dv = .4; |
| 48 |
c_z_s = -.2; |
| 49 |
cx = 1.0; |
| 50 |
cy = 1.0; |
| 51 |
|
| 52 |
|
| 53 |
lambda = 0.5; // Share of optimizing agents. |
| 54 |
|
| 55 |
trend_component_model(model_name=toto, eqtags=['eq:x1', 'eq:x2', 'eq:x1bar', 'eq:x2bar'], targets=['eq:x1bar', 'eq:x2bar']); |
| 56 |
|
| 57 |
pac_model(auxiliary_model_name=toto, discount=beta, model_name=pacman); |
| 58 |
|
| 59 |
model; |
| 60 |
|
| 61 |
[name='eq:s'] |
| 62 |
s = .3*s(-1) - .1*s(-2) + es; |
| 63 |
|
| 64 |
[name='eq:diff(v)'] |
| 65 |
diff(v) = .5*diff(v(-1)) + ev; |
| 66 |
|
| 67 |
[name='eq:u'] |
| 68 |
u = .5*u(-1) - .2*u(-2) + eu; |
| 69 |
|
| 70 |
[name='eq:y'] |
| 71 |
y = rho_1*y(-1) + rho_2*y(-2) + ey; |
| 72 |
|
| 73 |
[name='eq:x'] |
| 74 |
x = rho_3*x(-1) + rho_4*x(-2) + ex; |
| 75 |
|
| 76 |
[name='eq:x1'] |
| 77 |
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; |
| 78 |
|
| 79 |
[name='eq:x2'] |
| 80 |
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; |
| 81 |
|
| 82 |
[name='eq:x1bar'] |
| 83 |
x1bar = x1bar(-1) + ex1bar; |
| 84 |
|
| 85 |
[name='eq:x2bar'] |
| 86 |
x2bar = x2bar(-1) + ex2bar; |
| 87 |
|
| 88 |
[name='zpac'] |
| 89 |
diff(z) = lambda*(e_c_m*(x1(-1)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(pacman) + c_z_s*s + c_z_dv*diff(v) ) + (1-lambda)*( cy*y + cx*x) + c_z_u*u + c_z_dx2*diff(x2) + ez; |
| 90 |
|
| 91 |
end; |
| 92 |
|
| 93 |
shocks; |
| 94 |
var ex1 = 1.0; |
| 95 |
var ex2 = 1.0; |
| 96 |
var ex1bar = 1.0; |
| 97 |
var ex2bar = 1.0; |
| 98 |
var ez = 1.0; |
| 99 |
var ey = 0.1; |
| 100 |
var ex = 0.1; |
| 101 |
var eu = 0.05; |
| 102 |
var ev = 0.05; |
| 103 |
var es = 0.07; |
| 104 |
end; |
| 105 |
|
| 106 |
// Initialize the PAC model (build the Companion VAR representation for the auxiliary model). |
| 107 |
pac.initialize('pacman'); |
| 108 |
|
| 109 |
// Update the parameters of the PAC expectation model (h0 and h1 vectors). |
| 110 |
pac.update.expectation('pacman'); |
| 111 |
|
| 112 |
// Select a subset of the equations and print the equations, the list of parameters, endogenous |
| 113 |
// variables and exogenous variables in .inc files under ./simulation-files folder. Note that |
| 114 |
// innovations ex1bar and ex2bar will not appear in the equations. |
| 115 |
cherrypick('example1', 'simulation-files', {'zpac', 'eq:x1', 'eq:x2', 'eq:x1bar', 'eq:x2bar'}, true); |