Skip to content
Snippets Groups Projects
Commit ce1bfc99 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

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.

(cherry picked from commit 1f20ceb4)
parent 98442b4e
No related branches found
No related tags found
No related merge requests found
......@@ -260,23 +260,23 @@ for b=fpar:B
else
constant_part=repmat(SteadyState(dr.order_var)',[length(options_.filter_step_ahead),1,gend+max(options_.filter_step_ahead)]);
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
for ii=1:length(options_.filter_step_ahead)
if options_.prefilter
stock_filter_step_ahead(ii,IdObs,:,irun(4)) = squeeze(stock_filter_step_ahead(ii,IdObs,:,irun(4)))...
+repmat(mean_correction(:,1),1,gend+max(options_.filter_step_ahead))... %constant correction
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 ...
+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
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
end
end
end
if horizon
yyyy = alphahat(iendo,i_last_obs);
yf = forcst2a(yyyy,dr,zeros(horizon,exo_nbr));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment