From f89a969a93f9d620881cf894eeb96b11ecd542ff Mon Sep 17 00:00:00 2001 From: Michel Juillard <michel.juillard@mjui.fr> Date: Wed, 15 Jul 2020 22:26:11 +0200 Subject: [PATCH] fix bug with lag on exogenous variables on more than one period (cherry picked from commit 492124ce9886e6aef4f4cefef302241d7edfe024) --- matlab/perfect-foresight-models/sim1_purely_backward.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matlab/perfect-foresight-models/sim1_purely_backward.m b/matlab/perfect-foresight-models/sim1_purely_backward.m index b3d88a7123..689d4f310d 100644 --- a/matlab/perfect-foresight-models/sim1_purely_backward.m +++ b/matlab/perfect-foresight-models/sim1_purely_backward.m @@ -38,13 +38,13 @@ dynamicmodel = str2func([M.fname,'.dynamic']); info.status = 1; -for it = 2:options.periods+1 +for it = M.maximum_lag + (1:options.periods) yb = endogenousvariables(:,it-1); % Values at previous period, also used as guess value for current period yb1 = yb(iyb); [tmp, check] = solve1(dynamicmodel, [yb1; yb], 1:M.endo_nbr, nyb+1:nyb+M.endo_nbr, ... 1, options.gstep, options.dynatol.f, options.dynatol.x, ... options.simul.maxit, options.debug, exogenousvariables, ... - M.params, steadystate, it+M.maximum_lag-1); + M.params, steadystate, it); if check info.status = 0; end -- GitLab