var_forecast: example with two variables in var

time-shift
Houtan Bastani 2016-11-29 17:23:45 +01:00 committed by Stéphane Adjemian (Charybdis)
parent 858f26804f
commit 8d1c8f35ae
2 changed files with 9 additions and 9 deletions

View File

@ -13,7 +13,7 @@ theta = 2.95;
phi = 0.1;
var_model(model_name=my_var_est, order=3) y;
var_model(model_name=my_var_est, order=3) y c;
model;
c*theta*h^(1+psi)=(1-alpha)*y;

View File

@ -18,20 +18,20 @@ disp('VAR Estimation');
% Y = mu + B*Z
% from New Introduction to Multiple Time Series Analysis
% Just y in order 3 var:
Y = oo_.endo_simul(1, 4:end);
% y and c in order 3 var:
Y = oo_.endo_simul(1:2, 4:end);
Z = [ ...
ones(1, size(Y,2)); ...
oo_.endo_simul(1, 3:end-1); ...
oo_.endo_simul(1, 2:end-2); ...
oo_.endo_simul(1, 1:end-3); ...
oo_.endo_simul(1:2, 3:end-1); ...
oo_.endo_simul(1:2, 2:end-2); ...
oo_.endo_simul(1:2, 1:end-3); ...
];
%B = Y*Z'*inv(Z*Z');
B = Y*Z'/(Z*Z');
mu = B(:, 1);
autoregressive_matrices{1} = B(:, 2);
autoregressive_matrices{2} = B(:, 3);
autoregressive_matrices{3} = B(:, 4);
autoregressive_matrices{1} = B(:, 2:3);
autoregressive_matrices{2} = B(:, 4:5);
autoregressive_matrices{3} = B(:, 6:7);
% Sims
% (provides same result as above)