From 2816550290c29a43c475c80adaf5b349d2e0b883 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Tue, 26 Jul 2022 14:44:26 +0200 Subject: [PATCH] PKF: get required output if nk=1 Related to https://git.dynare.org/Dynare/dynare/-/issues/1861 --- matlab/missing_DiffuseKalmanSmootherH3_Z.m | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/matlab/missing_DiffuseKalmanSmootherH3_Z.m b/matlab/missing_DiffuseKalmanSmootherH3_Z.m index 6ba116349..8f100f528 100644 --- a/matlab/missing_DiffuseKalmanSmootherH3_Z.m +++ b/matlab/missing_DiffuseKalmanSmootherH3_Z.m @@ -341,6 +341,9 @@ while notsteady && 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)) - out.ys(oo_.dr.order_var(oo_.dr.restrict_var_list))'; + if jnk>1 + 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)) - out.ys(oo_.dr.order_var(oo_.dr.restrict_var_list))'; + else + aK(jnk,oo_.dr.inv_order_var,t+jnk) = out.piecewise(jnk,:) - out.ys'; + end else - aK(jnk,oo_.dr.inv_order_var,t+jnk) = out.piecewise(jnk,:) - out.ys'; + aK(jnk,:,t+jnk) = T*dynare_squeeze(aK(jnk-1,:,t+jnk-1)); end - elseif jnk>1 - aK(jnk,:,t+jnk) = T*dynare_squeeze(aK(jnk-1,:,t+jnk-1)); end end end