From dfc89df6a8f5ff0f94c515934caf576088f5c5f6 Mon Sep 17 00:00:00 2001 From: Michel Juillard Date: Sun, 15 Feb 2015 17:49:01 +0100 Subject: [PATCH] added make_ex_ to fix bug in dyn_forecast and fixed length of output --- matlab/dyn_forecast.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/matlab/dyn_forecast.m b/matlab/dyn_forecast.m index 5df0edbf8..242b0ea9e 100644 --- a/matlab/dyn_forecast.m +++ b/matlab/dyn_forecast.m @@ -37,6 +37,8 @@ global options_ oo_ M_ info = 0; +make_ex_; + maximum_lag = M_.maximum_lag; endo_names = M_.endo_names; @@ -122,15 +124,15 @@ if ~isscalar(trend) end for i=1:n_var - eval(['oo_.forecast.Mean.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+1:end)'';']); - eval(['oo_.forecast.HPDinf.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+1:end)''-' ... - ' int_width(:,' int2str(i) ');']); - eval(['oo_.forecast.HPDsup.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+1:end)''+' ... - ' int_width(:,' int2str(i) ');']); + eval(['oo_.forecast.Mean.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+(1:horizon))'';']); + eval(['oo_.forecast.HPDinf.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+(1:horizon))''-' ... + ' int_width(1:horizon,' int2str(i) ');']); + eval(['oo_.forecast.HPDsup.' var_list(i,:) '= yf(' int2str(i) ',maximum_lag+(1:horizon))''+' ... + ' int_width(1:horizon,' int2str(i) ');']); end for i=1:M_.exo_det_nbr - eval(['oo_.forecast.Exogenous.' M_.exo_det_names(i,:) '= oo_.exo_det_simul(:,' int2str(i) ');']); + eval(['oo_.forecast.Exogenous.' M_.exo_det_names(i,:) '= oo_.exo_det_simul(maximum_lag+(1:horizon),' int2str(i) ');']); end if options_.nograph == 0