diff --git a/matlab/DsgeSmoother.m b/matlab/DsgeSmoother.m index 8922a2b5a37b01aad94bd924a3ae5893ab9fbdfc..19b74eaeb57c9744b8a2e069664d3d468164c002 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 aa06d67dc76187cbad7826bb38cb45e026506a0e..6b5404eb062a65cc497ebc3e6e355e2aabacb557 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));