From 2e42c85e69690d4c6ebfa5f0c57305e42c789545 Mon Sep 17 00:00:00 2001
From: Marco Ratto <marco.ratto@ec.europa.eu>
Date: Thu, 26 Jan 2023 09:24:17 +0100
Subject: [PATCH] bug fixes when using guess regime

---
 matlab/+occbin/solve_two_constraints.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/matlab/+occbin/solve_two_constraints.m b/matlab/+occbin/solve_two_constraints.m
index 9869f63394..eab9c269b6 100644
--- a/matlab/+occbin/solve_two_constraints.m
+++ b/matlab/+occbin/solve_two_constraints.m
@@ -164,7 +164,6 @@ for shock_period = 1:n_shocks_periods
             % unconstrained regime (nperiods_0)
             binding_indicator=[binding_indicator; false(nperiods_0 + 1-size(binding_indicator,1),2)];
         end
-        binding_indicator_history{iter}=binding_indicator;
         
         if iter==1 && guess_history_it
             regime_1 = regime_history_guess(shock_period).regime1;
@@ -181,6 +180,8 @@ for shock_period = 1:n_shocks_periods
             end
             nperiods_0 = size(binding_indicator,1)-1; %if history is present, update may be required
         end
+        binding_indicator_history{iter}=binding_indicator;
+        
         % analyse violvec and isolate contiguous periods in the other regime.
         [regime_1, regime_start_1, error_code_period(1)]=occbin.map_regime(binding_indicator(:,1),opts_simul_.debug);
         regime_history(shock_period).regime1 = regime_1;
-- 
GitLab