From 28182d07bd27926b47406e976fe91840d421acc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 28 Mar 2023 19:19:19 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Ramsey=20steady=20state=20comput?=
 =?UTF-8?q?ation=20could=20fail=20if=20expectation=20or=20diff=20operator?=
 =?UTF-8?q?=20is=20present?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If auxiliary variables were created *before* the Lagrange multipliers (e.g. aux
vars related to the expectation or diff operators), then the vector of
residuals of the reduced Ramsey steady state problem (with respect to original
variables, as computed by the dyn_ramsey_static_1 subfunction) was incorrect.
---
 matlab/dyn_ramsey_static.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/dyn_ramsey_static.m b/matlab/dyn_ramsey_static.m
index 8509c694cb..f23db49d82 100644
--- a/matlab/dyn_ramsey_static.m
+++ b/matlab/dyn_ramsey_static.m
@@ -175,7 +175,7 @@ end
 if options_.steadystate_flag
     resids = r1;
 else
-    resids = [res(orig_endo_nbr+(1:orig_endo_nbr-inst_nbr)); r1];
+    resids = [res(orig_endo_aux_nbr+(1:orig_endo_nbr-inst_nbr)); r1];
 end
 rJ = [];
 if needs_set_auxiliary_variables
-- 
GitLab