From bfd92e79a774c057cfe9b9403e37cc15667f05d9 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Thu, 12 Aug 2021 20:07:39 +0200
Subject: [PATCH] Occbin: udpate options

---
 matlab/+occbin/DSGE_smoother.m                     |  1 +
 matlab/+occbin/set_default_options.m               | 14 +++++++-------
 matlab/+occbin/setup.m                             | 12 +++++++++++-
 preprocessor                                       |  2 +-
 .../model_irrcap_twoconstraints/dynrbc_common.inc  |  5 ++---
 5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/matlab/+occbin/DSGE_smoother.m b/matlab/+occbin/DSGE_smoother.m
index 3b89353645..93c5fe5f0d 100644
--- a/matlab/+occbin/DSGE_smoother.m
+++ b/matlab/+occbin/DSGE_smoother.m
@@ -106,6 +106,7 @@ opts_simul.maxit = options_.occbin.smoother.maxit;
 opts_simul.waitbar = options_.occbin.smoother.waitbar;
 opts_simul.periods = options_.occbin.smoother.periods;
 opts_simul.check_ahead_periods = options_.occbin.smoother.check_ahead_periods;
+opts_simul.periodic_solution = options_.occbin.smoother.periodic_solution;
 opts_simul.full_output = options_.occbin.smoother.full_output;
 opts_simul.piecewise_only = options_.occbin.smoother.piecewise_only;
 % init_mode = options_.occbin.smoother.init_mode; % 0 = standard;  1 = unconditional frcsts zero shocks+smoothed states in each period
diff --git a/matlab/+occbin/set_default_options.m b/matlab/+occbin/set_default_options.m
index 568fbc5418..7f81b7e9ac 100644
--- a/matlab/+occbin/set_default_options.m
+++ b/matlab/+occbin/set_default_options.m
@@ -73,14 +73,14 @@ if ismember(flag,{'likelihood','all'})
     options_occbin_.likelihood.init_binding_indicator = false(0);
     options_occbin_.likelihood.inversion_filter = false;
     options_occbin_.likelihood.IVF_shock_observable_mapping = [];
-    options_occbin_.likelihood.maxit = 50; % this is for occbin solver algo
+    options_occbin_.likelihood.maxit = 30; % this is for occbin solver algo
     options_occbin_.likelihood.max_number_of_iterations = 10; % this is for occbin_kalman_update loop
     options_occbin_.likelihood.periods = 100;
     options_occbin_.likelihood.check_ahead_periods=200;
-    options_occbin_.likelihood.periodic_solution=true;
+    options_occbin_.likelihood.periodic_solution=false;
     options_occbin_.likelihood.piecewise_only = true;
     options_occbin_.likelihood.restrict_state_space = true;
-    options_occbin_.likelihood.status=true;
+    options_occbin_.likelihood.status=true; %initialized to false in default_option_values
     options_occbin_.likelihood.use_updated_regime = true;
     options_occbin_.likelihood.waitbar=false;
 end
@@ -168,12 +168,11 @@ if ismember(flag,{'simul','all'})
     options_occbin_.simul.init_regime=[];
     options_occbin_.simul.init_binding_indicator=false(0);
     options_occbin_.simul.exo_pos=1:M_.exo_nbr;
-    options_occbin_.simul.local=true;
-    options_occbin_.simul.maxit=10;
+    options_occbin_.simul.maxit=30;
     options_occbin_.simul.max_periods=inf;
-    options_occbin_.simul.periods=30;
+    options_occbin_.simul.periods=100;
     options_occbin_.simul.check_ahead_periods=200;
-    options_occbin_.simul.periodic_solution=true;
+    options_occbin_.simul.periodic_solution=false;
     options_occbin_.simul.piecewise_only = false;
     options_occbin_.simul.reset_regime_in_new_period = false;
     options_occbin_.simul.restrict_state_space=false;
@@ -196,6 +195,7 @@ if ismember(flag,{'smoother','all'})
     options_occbin_.smoother.max_number_of_iterations = 10; % this is for smoother loop
     options_occbin_.smoother.periods = 100;
     options_occbin_.smoother.check_ahead_periods=200;
+    options_occbin_.smoother.periodic_solution=false;
     options_occbin_.smoother.piecewise_only = true;
     options_occbin_.smoother.plot = true;
     options_occbin_.smoother.status=true;
diff --git a/matlab/+occbin/setup.m b/matlab/+occbin/setup.m
index 71d6b326d8..f2dab58a43 100644
--- a/matlab/+occbin/setup.m
+++ b/matlab/+occbin/setup.m
@@ -32,13 +32,23 @@ options_ = occbin.set_option(options_,options_occbin_,'simul.periods');
 options_ = occbin.set_option(options_,options_occbin_,'simul.curb_retrench');
 options_ = occbin.set_option(options_,options_occbin_,'simul.maxit');
 options_ = occbin.set_option(options_,options_occbin_,'simul.check_ahead_periods');
+options_ = occbin.set_option(options_,options_occbin_,'simul.debug');
+options_ = occbin.set_option(options_,options_occbin_,'simul.periodic_solution');
 options_ = occbin.set_option(options_,options_occbin_,'smoother.periods');
 options_ = occbin.set_option(options_,options_occbin_,'smoother.curb_retrench');
 options_ = occbin.set_option(options_,options_occbin_,'smoother.maxit');
 options_ = occbin.set_option(options_,options_occbin_,'smoother.check_ahead_periods');
+options_ = occbin.set_option(options_,options_occbin_,'smoother.debug');
+options_ = occbin.set_option(options_,options_occbin_,'smoother.periodic_solution');
+options_ = occbin.set_option(options_,options_occbin_,'smoother.inversion_filter');
+options_ = occbin.set_option(options_,options_occbin_,'likelihood.periods');
+options_ = occbin.set_option(options_,options_occbin_,'likelihood.curb_retrench');
+options_ = occbin.set_option(options_,options_occbin_,'likelihood.maxit');
+options_ = occbin.set_option(options_,options_occbin_,'likelihood.check_ahead_periods');
+options_ = occbin.set_option(options_,options_occbin_,'likelihood.periodic_solution');
+options_ = occbin.set_option(options_,options_occbin_,'likelihood.max_number_of_iterations');
 options_ = occbin.set_option(options_,options_occbin_,'filter.use_relaxation');
 options_ = occbin.set_option(options_,options_occbin_,'likelihood.inversion_filter');
-options_ = occbin.set_option(options_,options_occbin_,'smoother.inversion_filter');
 
 if isfield(M_,'surprise_shocks') && ~isempty(M_.surprise_shocks)
     temp=zeros(max(cat(2,M_.surprise_shocks.periods)),M_.exo_nbr);
diff --git a/preprocessor b/preprocessor
index f0c39b461e..6fb86522ea 160000
--- a/preprocessor
+++ b/preprocessor
@@ -1 +1 @@
-Subproject commit f0c39b461e8307292ae73df702897424f07cea8d
+Subproject commit 6fb86522ea836e6dfcc9b39c0c8226168e0a2730
diff --git a/tests/occbin/model_irrcap_twoconstraints/dynrbc_common.inc b/tests/occbin/model_irrcap_twoconstraints/dynrbc_common.inc
index 3379aebe5f..56855c0e08 100644
--- a/tests/occbin/model_irrcap_twoconstraints/dynrbc_common.inc
+++ b/tests/occbin/model_irrcap_twoconstraints/dynrbc_common.inc
@@ -58,9 +58,8 @@ end
 
 % set inputs      
 
-occbin_setup;
-options_.occbin.smoother.debug=1;
-occbin_solver(simul_periods=200,simul_maxit=200,simul_curb_retrench,simul_check_ahead_periods=200);
+occbin_setup(smoother_debug);
+occbin_solver(simul_debug,simul_periodic_solution,simul_periods=200,simul_maxit=200,simul_curb_retrench,simul_check_ahead_periods=200);
 occbin_write_regimes(filename='test',periods=[1:100]);
 
 %% Modify to plot IRFs 
-- 
GitLab