Commit 1f20ceb4 authored by Stéphane Adjemian's avatar Stéphane Adjemian

Fixed bug in filtered variables with trend.

Was crashing in models with only one observed variable. The squeeze function
cannot be used in this case, only the first dimension  of
stock_filter_step_ahead should be squeezed.
parent cc9e0ed0
...@@ -260,23 +260,23 @@ for b=fpar:B ...@@ -260,23 +260,23 @@ for b=fpar:B
else else
constant_part=repmat(SteadyState(dr.order_var)',[length(options_.filter_step_ahead),1,gend+max(options_.filter_step_ahead)]); constant_part=repmat(SteadyState(dr.order_var)',[length(options_.filter_step_ahead),1,gend+max(options_.filter_step_ahead)]);
end end
stock_filter_step_ahead(:,dr.order_var,:,irun(4)) = aK(options_.filter_step_ahead,1:endo_nbr,:) + constant_part;
stock_filter_step_ahead(:,dr.order_var,:,irun(4)) = aK(options_.filter_step_ahead,1:endo_nbr,:) + ...
constant_part;
%now add trend to observables %now add trend to observables
for ii=1:length(options_.filter_step_ahead) for ii=1:length(options_.filter_step_ahead)
if options_.prefilter if options_.prefilter
stock_filter_step_ahead(ii,IdObs,:,irun(4)) = squeeze(stock_filter_step_ahead(ii,IdObs,:,irun(4)))... zdim = size(stock_filter_step_ahead(ii,IdObs,:,irun(4)));
+repmat(mean_correction(:,1),1,gend+max(options_.filter_step_ahead))... %constant correction squeezed = reshape(stock_filter_step_ahead(ii,IdObs,:,irun(4)), [zdim(2:end) 1]);
stock_filter_step_ahead(ii,IdObs,:,irun(4)) = squeezed ...
+repmat(mean_correction(:,1),1,gend+max(options_.filter_step_ahead)) ... %constant correction
+[trend_addition repmat(trend_addition(:,end),1,max(options_.filter_step_ahead))+trend_coeff*[1:max(options_.filter_step_ahead)]]; %trend +[trend_addition repmat(trend_addition(:,end),1,max(options_.filter_step_ahead))+trend_coeff*[1:max(options_.filter_step_ahead)]]; %trend
else else
stock_filter_step_ahead(ii,IdObs,:,irun(4)) = squeeze(stock_filter_step_ahead(ii,IdObs,:,irun(4)))... zdim = size(stock_filter_step_ahead(ii,IdObs,:,irun(4)));
squeezed = reshape(stock_filter_step_ahead(ii,IdObs,:,irun(4)), [zdim(2:end) 1]);
stock_filter_step_ahead(ii,IdObs,:,irun(4)) = squeezed ...
+[trend_addition repmat(trend_addition(:,end),1,max(options_.filter_step_ahead))+trend_coeff*[1:max(options_.filter_step_ahead)]]; %trend +[trend_addition repmat(trend_addition(:,end),1,max(options_.filter_step_ahead))+trend_coeff*[1:max(options_.filter_step_ahead)]]; %trend
end end
end end
end end
if horizon if horizon
yyyy = alphahat(iendo,i_last_obs); yyyy = alphahat(iendo,i_last_obs);
yf = forcst2a(yyyy,dr,zeros(horizon,exo_nbr)); yf = forcst2a(yyyy,dr,zeros(horizon,exo_nbr));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment