From a52b96da80dab61c0f8c3cfb0d866412a7cd61f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?D=C3=B3ra=20Kocsis?= <dora@dynare.org>
Date: Thu, 12 Mar 2020 14:49:13 +0100
Subject: [PATCH] add missing estimation options: 
 nonlinear_filter_initialization, cpf_weights, smoothed_state_uncertainty

---
 src/+gui_auxiliary/command_option_mapping.m      |  3 +++
 .../dynare_command_options_estimation.m          | 16 ++++++++++++++++
 src/+gui_auxiliary/set_command_option.m          |  6 ++++++
 3 files changed, 25 insertions(+)

diff --git a/src/+gui_auxiliary/command_option_mapping.m b/src/+gui_auxiliary/command_option_mapping.m
index 5766d95..53c6295 100644
--- a/src/+gui_auxiliary/command_option_mapping.m
+++ b/src/+gui_auxiliary/command_option_mapping.m
@@ -79,6 +79,9 @@ switch name
 
     case 'no_posterior_kernel_density'
         mapping = 'estimation.moments_posterior_density.indicator';
+        
+    case 'nonlinear_filter_initialization'
+        mapping = 'nonlinear_filter';
 
     case 'number_of_particles'
         mapping = 'particle.number_of_particles';
diff --git a/src/+gui_auxiliary/dynare_command_options_estimation.m b/src/+gui_auxiliary/dynare_command_options_estimation.m
index 6720126..2fcb15f 100644
--- a/src/+gui_auxiliary/dynare_command_options_estimation.m
+++ b/src/+gui_auxiliary/dynare_command_options_estimation.m
@@ -410,6 +410,12 @@ dynare_gui_.estimation.filter{num,2} = '1';
 dynare_gui_.estimation.filter{num,3} = 'INTEGER';
 dynare_gui_.estimation.filter{num,4} = 'Decide whether Dynare should automatically switch to univariate filter if a singularity is encountered in the likelihood computation (this is the behaviour if the option is equal to 1). Alternatively, if the option is equal to 0, Dynare will not automatically change the filter, but rather use a penalty value for the likelihood when such a singularity is encountered. Default: 1.';
 
+num = num+1;
+dynare_gui_.estimation.filter{num,1} = 'smoothed_state_uncertainty';
+dynare_gui_.estimation.filter{num,2} = 0;
+dynare_gui_.estimation.filter{num,3} = 'check_option';
+dynare_gui_.estimation.filter{num,4} = 'Triggers the computation of the variance of smoothed estimates, i.e. varT(yt).';
+
 num = num+1;
 dynare_gui_.estimation.filter{num,1} = 'diffuse_filter';
 dynare_gui_.estimation.filter{num,2} = 0;
@@ -540,7 +546,17 @@ dynare_gui_.estimation.postprocessing{num,2} = 'unscented';
 dynare_gui_.estimation.postprocessing{num,3} = {'unscented','cubature','montecarlo'};
 dynare_gui_.estimation.postprocessing{num,4} = 'Sets the method for approximating the particle distribution. Possible values for OPTION are: cubature, montecarlo and unscented. Default value is unscented.';
 
+num = num+1;
+dynare_gui_.estimation.postprocessing{num,1} = 'cpf_weights';
+dynare_gui_.estimation.postprocessing{num,2} = 'amisanotristani';
+dynare_gui_.estimation.postprocessing{num,3} = {'amisanotristani','murrayjonesparslow'};
+dynare_gui_.estimation.postprocessing{num,4} = 'Controls the method used to update the weights in conditional particle filter, possible values are amisanotristani (Amisano et al. (2010)) or murrayjonesparslow (Murray et al. (2013)).';
 
+num = num+1;
+dynare_gui_.estimation.postprocessing{num,1} = 'nonlinear_filter_initialization';
+dynare_gui_.estimation.postprocessing{num,2} = '1';
+dynare_gui_.estimation.postprocessing{num,3} = 'INTEGER';
+dynare_gui_.estimation.postprocessing{num,4} = 'Sets the initial condition of the nonlinear filters. By default the nonlinear filters are initialized with the unconditional covariance matrix of the state variables, computed with the reduced form solution of the first order approximation of the model.';
 
 %% Group 7: Particle filter
 num = 1;
diff --git a/src/+gui_auxiliary/set_command_option.m b/src/+gui_auxiliary/set_command_option.m
index ab24e61..a45c533 100644
--- a/src/+gui_auxiliary/set_command_option.m
+++ b/src/+gui_auxiliary/set_command_option.m
@@ -180,6 +180,12 @@ try
                 options_.particle.proposal_approximation.montecarlo = true;
             end
             
+        case 'cpf_weights'
+            if value == 2
+                options_.particle.cpf_weights_method.amisanotristani = false;
+                options_.particle.cpf_weights_method.murrayjonesparslow = true;
+            end
+
         case 'posterior_nograph'
             options_.no_graph.posterior = logical(value);
 
-- 
GitLab