From 1ae729929bad606cc39fa2c5149ebb9dd9effa73 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Mon, 27 Aug 2018 14:51:54 +0200
Subject: [PATCH] fix bug when var_expectation_model uses trend_component_model
 as auxiliary model

---
 src/ModFile.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ModFile.cc b/src/ModFile.cc
index 77a071dc..ee3512c0 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -524,7 +524,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
         }
       else if (trend_component_model_table.isExistingTrendComponentModelName(vems->aux_model_name))
         {
-          max_lag = trend_component_model_table.getMaxLag(vems->aux_model_name);
+          max_lag = trend_component_model_table.getMaxLag(vems->aux_model_name) + 1;
           lhs = trend_component_model_table.getLhs(vems->aux_model_name);
         }
       else
-- 
GitLab