From 0a017dd1bb1a2f630bcff01ebdb54399be3ce952 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 28 Dec 2016 12:48:30 +0100 Subject: [PATCH] var test, add estimation for nkm model, fix plotting --- tests/ECB/run_var_comparison.m | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/ECB/run_var_comparison.m b/tests/ECB/run_var_comparison.m index a0a5e7cc7..8b197c35f 100644 --- a/tests/ECB/run_var_comparison.m +++ b/tests/ECB/run_var_comparison.m @@ -13,7 +13,7 @@ save('nkm_saved_data.mat') %% Estimate VAR using simulated data disp('VAR Estimation'); - +%% UNCOMMENT IF RUNNING EXAMPLE1 % MLS estimate of mu and B (autoregressive_matrices) % Y = mu + B*Z % from New Introduction to Multiple Time Series Analysis @@ -33,6 +33,17 @@ autoregressive_matrices{1} = B(:, 2:3); autoregressive_matrices{2} = B(:, 4:5); autoregressive_matrices{3} = B(:, 6:7); +%% UNCOMMENT IF RUNNING ESTIMATION FOR NKM +% % FOR NKM +% Y = oo_.endo_simul(2:3, 2:end); +% Z = [ ... +% ones(1, size(Y,2)); ... +% oo_.endo_simul(2:3, 1:end-1); ... +% ]; +% B = Y*Z'/(Z*Z'); +% mu = B(:, 1); +% autoregressive_matrices{1} = B(:, 2:3); + % Sims % (provides same result as above) % var = rfvar3(Y',1,zeros(size(Y')),0,5,2) @@ -66,9 +77,9 @@ for i = 1:length(exo_names) for j = 1:length(endo_names) subplot(ridx, cidx, j); hold on - title(endo_names(j)); - plot(nv.oo_.irfs.([endo_names(j) '_' exo_names(i)])); - plot(wv.oo_.irfs.([endo_names(j) '_' exo_names(i)]), '--'); + title(endo_names(j,:)); + plot(nv.oo_.irfs.([deblank(endo_names(j,:)) '_' deblank(exo_names(i,:))])); + plot(wv.oo_.irfs.([deblank(endo_names(j,:)) '_' deblank(exo_names(i,:))]), '--'); hold off end end \ No newline at end of file