Adapted mod files for new PAC interface.

time-shift
Stéphane Adjemian(Charybdis) 2018-04-10 14:47:34 +02:00
parent 9f02392ee6
commit d09268e2ab
6 changed files with 46 additions and 6 deletions

View File

@ -3,4 +3,5 @@
rm -rf example
rm -f example_dynamic.json example.json example.m example_original.json example_static.json
rm -f example_dynamic.m example.log example_set_auxiliary_variables.m example_static.m
rm -f example_dynamic_set_auxiliary_series.m
rm -f example_results.mat

View File

@ -22,6 +22,8 @@ c_z_2 = -.3;
var_model(model_name=toto, eqtags=['eq:x', 'eq:y']);
pac_model(var_model_name=toto, discount=beta, model_name=pacman);
model;
[name='eq:y']
@ -31,7 +33,7 @@ y = a_y_1*y(-1) + a_y_2*diff(x(-1)) + b_y_1*y(-2) + b_y_2*diff(x(-2)) + ey ;
diff(x) = b_x_1*y(-2) + b_x_2*diff(x(-1)) + ex ;
[name='eq:pac']
diff(z) = e_c_m*(x(-1)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(model_name=pacman, var_model_name=toto, discount=beta) + ez;
diff(z) = e_c_m*(x(-1)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(pacman) + ez;
end;

7
examples/2/clean Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
rm -rf example
rm -f example_dynamic.json example.json example.m example_original.json example_static.json
rm -f example_dynamic.m example.log example_set_auxiliary_variables.m example_static.m
rm -f example_dynamic_set_auxiliary_series.m
rm -f example_results.mat

View File

@ -1,6 +1,6 @@
// --+ options: json=compute +--
var y x z;
var y x z ;
varexo ex ey ez;
@ -24,6 +24,8 @@ gamma = .7;
var_model(model_name=toto, eqtags=['eq:x', 'eq:y']);
pac_model(var_model_name=toto, discount=beta, model_name=pacman);
model;
[name='eq:y']
@ -33,8 +35,25 @@ y = a_y_1*y(-1) + a_y_2*diff(x(-1)) + b_y_1*y(-2) + b_y_2*diff(x(-2)) + ey ;
diff(x) = b_x_1*y(-2) + b_x_2*diff(x(-1)) + ex ;
[name='eq:pac']
diff(z) = gamma*(e_c_m*(x(-1)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(model_name=pacman, var_model_name=toto, discount=beta)) + (1-gamma)*ez;
diff(z) = gamma*(e_c_m*(x(-1)-z(-1)) + c_z_1*diff(z(-1)) + c_z_2*diff(z(-2)) + pac_expectation(pacman)) + (1-gamma)*ez;
end;
get_companion_matrix('toto');
shocks;
var ey = 1.0;
var ex = 1.0;
var ez = 1.0;
end;
// Build the companion matrix of the VAR model (toto).
get_companion_matrix('toto');
// Update the parameters of the PAC expectation model (h0 and h1 vectors).
pac.update.equation('pacman');
// Set initial conditions to zero. Please use more sensible values if any...
initialconditions = dseries(zeros(10, M_.endo_nbr+M_.exo_nbr), 2000Q1, vertcat(M_.endo_names,M_.exo_names));
// Simulate the model for 500 periods
TrueData = simul_backward_model(initialconditions, 500);

7
examples/3/clean Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
rm -rf example
rm -f example_dynamic.json example.json example.m example_original.json example_static.json
rm -f example_dynamic.m example.log example_set_auxiliary_variables.m example_static.m
rm -f example_dynamic_set_auxiliary_series.m
rm -f example_results.mat

View File

@ -2,9 +2,9 @@
var y x z;
varexo ex ey ez g;
varexo ex ey ez ;
parameters a_y_1 a_y_2 b_y_1 b_y_2 b_x_1 b_x_2 ; // VAR parameters
parameters a_y_1 a_y_2 b_y_1 b_y_2 b_x_1 b_x_2 g; // VAR parameters
parameters beta e_c_m c_z_1 c_z_2; // PAC equation parameters
@ -20,8 +20,12 @@ e_c_m = .1;
c_z_1 = .7;
c_z_2 = -.3;
g = .02;
var_model(model_name=toto, eqtags=['eq:x', 'eq:y']);
model;
[name='eq:y']