From 12c4e03d7bc43e93c738b39e92c91f8060887139 Mon Sep 17 00:00:00 2001 From: Marco Ratto <marco.ratto@ec.europa.eu> Date: Wed, 26 Jan 2022 18:28:07 +0100 Subject: [PATCH] bug fixes in retrieving the k-step ahead predictions and updated variables from occbin simulations --- matlab/DsgeSmoother.m | 4 ++-- matlab/missing_DiffuseKalmanSmootherH3_Z.m | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/matlab/DsgeSmoother.m b/matlab/DsgeSmoother.m index 8922a2b5a3..19b74eaeb5 100644 --- a/matlab/DsgeSmoother.m +++ b/matlab/DsgeSmoother.m @@ -430,7 +430,7 @@ else % period ahead (so if regimestart was [1 5] it should be [1 4] % in out % end - bbb(oo_.dr.inv_order_var,k) = out.piecewise(1,:); + bbb(oo_.dr.inv_order_var,k) = out.piecewise(1,:) - out.ys'; end end % do not overwrite accurate computations using reduced st. space @@ -475,7 +475,7 @@ else % in out % end for jnk=1:options_.nk - aaa(jnk,oo_.dr.inv_order_var,k+jnk-1) = out.piecewise(jnk,:); + aaa(jnk,oo_.dr.inv_order_var,k+jnk-1) = out.piecewise(jnk,:) - out.ys'; end end aK=aaa; diff --git a/matlab/missing_DiffuseKalmanSmootherH3_Z.m b/matlab/missing_DiffuseKalmanSmootherH3_Z.m index aa06d67dc7..6b5404eb06 100644 --- a/matlab/missing_DiffuseKalmanSmootherH3_Z.m +++ b/matlab/missing_DiffuseKalmanSmootherH3_Z.m @@ -433,7 +433,7 @@ while notsteady && t<smpl Pf = P(:,:,t+1); end aK(1,:,t+1) = a1(:,t+1); - if ~isempty(nk) && nk>1 && isoccbin + if ~isempty(nk) && nk>1 && isoccbin && (t>=first_period_occbin_update || isinf(first_period_occbin_update)) opts_simul = occbin_options.opts_regime; opts_simul.SHOCKS = zeros(nk,M_.exo_nbr); if smoother_redux @@ -455,11 +455,11 @@ while notsteady && t<smpl end PK(jnk,:,:,t+jnk) = Pf; end - if isoccbin + if isoccbin && (t>=first_period_occbin_update || isinf(first_period_occbin_update)) if smoother_redux - aK(jnk,:,t+jnk) = out.piecewise(jnk,oo_.dr.order_var(oo_.dr.restrict_var_list)); + aK(jnk,:,t+jnk) = out.piecewise(jnk,oo_.dr.order_var(oo_.dr.restrict_var_list)) - out.ys(oo_.dr.order_var(oo_.dr.restrict_var_list))'; else - aK(jnk,oo_.dr.inv_order_var,t+jnk) = out.piecewise(jnk,:); + aK(jnk,oo_.dr.inv_order_var,t+jnk) = out.piecewise(jnk,:) - out.ys'; end elseif jnk>1 aK(jnk,:,t+jnk) = T*dynare_squeeze(aK(jnk-1,:,t+jnk-1)); -- GitLab