diff --git a/src/+gui_auxiliary/command_option_mapping.m b/src/+gui_auxiliary/command_option_mapping.m index 71ab7db010272ad93e3302997faa93c69775c1c9..5766d95206c89494cd82e33c219223bae5c039dc 100644 --- a/src/+gui_auxiliary/command_option_mapping.m +++ b/src/+gui_auxiliary/command_option_mapping.m @@ -12,7 +12,7 @@ function mapping = command_option_mapping(name) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2003-2018 Dynare Team +% Copyright (C) 2003-2020 Dynare Team % % This file is part of Dynare. % @@ -80,27 +80,12 @@ switch name case 'no_posterior_kernel_density' mapping = 'estimation.moments_posterior_density.indicator'; - case 'proposal_approximation' - mapping = 'particle.proposal_approximation'; - - case 'distribution_approximation' - mapping = 'particle.distribution_approximation'; - case 'number_of_particles' mapping = 'particle.number_of_particles'; - case 'resampling' - mapping = 'particle.resampling.status'; - case 'resampling_threshold' mapping = 'particle.resampling.threshold'; - case 'resampling_method' - mapping = 'particle.resampling.method'; - - case 'filter_algorithm' - mapping = 'particle.filter_algorithm'; - case 'tex' mapping = 'TeX'; diff --git a/src/+gui_auxiliary/dynare_command_options_estimation.m b/src/+gui_auxiliary/dynare_command_options_estimation.m index ba7acffb377d0295a4ebfb22f15e7ed847713811..203308e4934738b6df5489a5d8515096fe9e7f77 100644 --- a/src/+gui_auxiliary/dynare_command_options_estimation.m +++ b/src/+gui_auxiliary/dynare_command_options_estimation.m @@ -337,6 +337,18 @@ dynare_gui_.estimation.MH_options{num,2} = '[0.2 0.5]'; dynare_gui_.estimation.MH_options{num,3} = '[DOUBLE DOUBLE]'; %special dynare_gui_.estimation.MH_options{num,4} = 'Percentage of MCMC draws at the beginning and end of the MCMC chain taken to compute the Geweke (1992,1999) convergence diagnostics (requires [mh nblocks]=1) after discarding the first [mh drop], page 54 percent of draws as a burnin. Default: [0.2 0.5].'; +num = num+1; +dynare_gui_.estimation.MH_options{num,1} = 'raftery_lewis_diagnostics'; +dynare_gui_.estimation.MH_options{num,2} = 0; +dynare_gui_.estimation.MH_options{num,3} = 'check_option'; +dynare_gui_.estimation.MH_options{num,4} = 'Triggers the computation of the Raftery and Lewis (1992) convergence diagnostics. The goal is deliver the number of draws required to estimate a particular quantile of the CDF q with precision r with a probability s. Typically, one wants to estimate the q=0.025 percentile (corresponding to a 95 percent HPDI) with a precision of 0.5 percent (r=0.005) with 95 percent certainty (s=0.95). The defaults can be changed via raftery_lewis_qrs.'; + +num = num+1; +dynare_gui_.estimation.MH_options{num,1} = 'raftery_lewis_qrs'; +dynare_gui_.estimation.MH_options{num,2} = '[0.025 0.005 0.95]'; +dynare_gui_.estimation.MH_options{num,3} = '[DOUBLE DOUBLE DOUBLE]'; %special +dynare_gui_.estimation.MH_options{num,4} = 'Sets the quantile of the CDF q that is estimated with precision r with a probability s in the Raftery and Lewis (1992) convergence diagnostics. Default: [0.025 0.005 0.95].'; + num = num+1; dynare_gui_.estimation.MH_options{num,1} = 'posterior_sampling_method'; dynare_gui_.estimation.MH_options{num,2} = 'random_walk_metropolis_hastings'; @@ -451,8 +463,8 @@ dynare_gui_.estimation.postprocessing{num,4} = 'Saves the contemporaneous correl num = num+1; dynare_gui_.estimation.postprocessing{num,1} = 'no_posterior_kernel_density'; -dynare_gui_.estimation.postprocessing{num,2} = '1'; % no default values in Reference Manual !!! -dynare_gui_.estimation.postprocessing{num,3} = 'INTEGER'; %type is check option in Reference Manual !!! +dynare_gui_.estimation.postprocessing{num,2} = 0; +dynare_gui_.estimation.postprocessing{num,3} = 'check_option'; dynare_gui_.estimation.postprocessing{num,4} = 'Shuts off the computation of the kernel density estimator for the posterior objects(see [density-field]).'; num = num+1; @@ -518,14 +530,14 @@ dynare_gui_.estimation.postprocessing{num,4} = 'Number of periods on which to co num = num+1; dynare_gui_.estimation.postprocessing{num,1} = 'proposal_approximation'; -dynare_gui_.estimation.postprocessing{num,2} = 'cubature'; -dynare_gui_.estimation.postprocessing{num,3} = {'cubature','montecarlo','unscented'}; +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 proposal distribution. Possible values for OPTION are: cubature, montecarlo and unscented. Default value is cubature.'; num = num+1; dynare_gui_.estimation.postprocessing{num,1} = 'distribution_approximation'; -dynare_gui_.estimation.postprocessing{num,2} = 'cubature'; -dynare_gui_.estimation.postprocessing{num,3} = {'cubature','montecarlo','unscented'}; +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.'; @@ -537,35 +549,29 @@ dynare_gui_.estimation.Particle_filter{num,2} = '5000'; %default is 1000 in R dynare_gui_.estimation.Particle_filter{num,3} = 'INTEGER'; dynare_gui_.estimation.Particle_filter{num,4} = 'Number of particles used when evaluating the likelihood of a non linear state space model. Default: 1000.'; - - - num = num+1; dynare_gui_.estimation.Particle_filter{num,1} = 'resampling'; -dynare_gui_.estimation.Particle_filter{num,2} = ''; %default is systematic ??? -dynare_gui_.estimation.Particle_filter{num,3} = {'','none','systematic','generic'}; +dynare_gui_.estimation.Particle_filter{num,2} = 'systematic'; +dynare_gui_.estimation.Particle_filter{num,3} = {'systematic','none','generic'}; dynare_gui_.estimation.Particle_filter{num,4} = 'Determines if resampling of the particles is done. Possible values for OPTION are: none, systematic and generic.'; - num = num+1; dynare_gui_.estimation.Particle_filter{num,1} = 'resampling_threshold'; dynare_gui_.estimation.Particle_filter{num,2} = ''; % default is 0.5 ??? dynare_gui_.estimation.Particle_filter{num,3} = 'DOUBLE'; dynare_gui_.estimation.Particle_filter{num,4} = 'A real number between zero and one. The resampling step is triggered as soon as the effective number of particles is less than this number times the total number of particles (as set by [number of particles]). This option is effective if and only if option [resampling] has value generic.'; - num = num+1; dynare_gui_.estimation.Particle_filter{num,1} = 'resampling_method'; -dynare_gui_.estimation.Particle_filter{num,2} = ''; %default is kitagawa??? +dynare_gui_.estimation.Particle_filter{num,2} = 'kitagawa'; dynare_gui_.estimation.Particle_filter{num,3} = {'kitagawa','stratified','smooth'}; dynare_gui_.estimation.Particle_filter{num,4} = 'Sets the resampling method. Possible values for OPTION are: kitagawa, stratified and smooth.'; - num = num+1; dynare_gui_.estimation.Particle_filter{num,1} = 'filter_algorithm'; -dynare_gui_.estimation.Particle_filter{num,2} = ''; -dynare_gui_.estimation.Particle_filter{num,3} = {'','sis','apf','gf','gmf','cpf'}; -dynare_gui_.estimation.Particle_filter{num,4} = 'Sets the particle filter algorithm. Possible values for OPTION are: sis, apf, gf, gmf and cpf.'; +dynare_gui_.estimation.Particle_filter{num,2} = 'sis'; +dynare_gui_.estimation.Particle_filter{num,3} = {'sis','apf','gf','gmf','cpf', 'nlkf'}; +dynare_gui_.estimation.Particle_filter{num,4} = 'Sets the particle filter algorithm. Possible values for OPTION are: sis, apf, gf, gmf, cpf, and nlkf.'; %% Group 8: output @@ -587,6 +593,12 @@ dynare_gui_.estimation.output{num,2} = 0; dynare_gui_.estimation.output{num,3} = 'check_option'; dynare_gui_.estimation.output{num,4} = 'Do not display the graphs, but still save them to disk (unless nograph is used).'; +num = num+1; +dynare_gui_.estimation.output{num,1} = 'posterior_nograph'; +dynare_gui_.estimation.output{num,2} = 0; +dynare_gui_.estimation.output{num,3} = 'check_option'; +dynare_gui_.estimation.output{num,4} = 'Suppresses the generation of graphs associated with Bayesian IRFs (bayesian_irf), posterior smoothed objects (smoother), and posterior forecasts (forecast).'; + num = num+1; dynare_gui_.estimation.output{num,1} = 'graph_format'; dynare_gui_.estimation.output{num,2} = 'eps'; diff --git a/src/+gui_auxiliary/set_command_option.m b/src/+gui_auxiliary/set_command_option.m index c9883565316c074cd40a3d7006e7db0095582a62..b57cbbd2342d7c4ad42bc416a3cb98b04d1c678e 100644 --- a/src/+gui_auxiliary/set_command_option.m +++ b/src/+gui_auxiliary/set_command_option.m @@ -48,18 +48,18 @@ try options_.lyapunov_db = 0; options_.lyapunov_srs = 0; - if strcmp(value, 'fixed_point') + if value == 3 % fixed_point options_.lyapunov_fp = 1; - elseif strcmp(value, 'doubling') + elseif value == 4 %doubling options_.lyapunov_db = 1; - elseif strcmp(value, 'square_root_solver') + elseif value == 5 %square_root_solver options_.lyapunov_srs = 1; end case 'sylvester' - if strcmp(value, 'default') + if value == 2 %default options_.sylvester_fp = 0; - else + elseif value == 3 %fixed_point options_.sylvester_fp = 1; end case 'dr' @@ -98,7 +98,7 @@ try end case 'filter_step_ahead' - options_.filter_step_ahead = eval(value); + options_.filter_step_ahead = str2num(value); case 'mcmc_jumping_covariance' if value == 2 @@ -117,6 +117,12 @@ try case 'mh_recover' options_.mh_recover = logical(value); + case 'raftery_lewis_diagnostics' + options_.convergence.rafterylewis.indicator = logical(value); + + case 'raftery_lewis_qrs' + options_.convergence.rafterylewis.qrs = str2num(value); + case 'posterior_sampling_method' if value == 2 options_.posterior_sampler_options.posterior_sampling_method = 'tailored_random_block_metropolis_hastings'; @@ -132,6 +138,50 @@ try case 'optim' options_.optim_opt = value; + case 'resampling' + if value == 2 + options_.particle.resampling.status.none = true; + elseif value == 3 + options_.particle.resampling.status.generic = true; + end + + case 'resampling_method' + if value == 2 + options_.particle.resampling.method.stratified = true; + elseif value == 3 + options_.particle.resampling.method.smooth = true; + end + + case 'filter_algorithm' + if value == 2 + options_.particle.filter_algorithm = 'apf'; + elseif value == 3 + options_.particle.filter_algorithm = 'gf'; + elseif value == 4 + options_.particle.filter_algorithm = 'gmf'; + elseif value == 5 + options_.particle.filter_algorithm = 'cpf'; + elseif value == 6 + options_.particle.filter_algorithm = 'nlkf'; + end + + case 'distribution_approximation' + if value == 2 + options_.particle.distribution_approximation.cubature = true; + elseif value == 3 + options_.particle.distribution_approximation.montecarlo = true; + end + + case 'proposal_approximation' + if value == 2 + options_.particle.proposal_approximation.cubature = true; + elseif value == 3 + options_.particle.proposal_approximation.montecarlo = true; + end + + case 'posterior_nograph' + options_.no_graph.posterior = logical(value); + otherwise if isnumeric(value) eval(['options_.' gui_auxiliary.command_option_mapping(name) '=' num2str(value) ';']); diff --git a/src/gui_define_comm_options.m b/src/gui_define_comm_options.m index 0683e89864697d4837a26cc18b1d9ef3c5631bba..cab37ced2267aebf33c4c96eaf737727c22b27cd 100644 --- a/src/gui_define_comm_options.m +++ b/src/gui_define_comm_options.m @@ -236,7 +236,8 @@ handles.pushbuttonReset = uicontrol( ... tab_handles.values(ii).String = num2str(user_defined_options.(group{ii,1}), 15); elseif strcmp(option_type, '[INTEGER1:INTEGER2]') ... || strcmp(option_type, 'INTEGER or [INTEGER1:INTEGER2]') ... - || strcmp(option_type, '[DOUBLE DOUBLE]') + || strcmp(option_type, '[DOUBLE DOUBLE]') ... + || strcmp(option_type, '[DOUBLE DOUBLE DOUBLE]') tab_handles.values(ii).Value = str2double(user_defined_options.(group{ii,1})); tab_handles.values(ii).String = user_defined_options.(group{ii,1}); elseif strcmp(option_type, 'eps, pdf, fig, none') ... @@ -351,7 +352,7 @@ handles.pushbuttonReset = uicontrol( ... return end switch option_type - case {'INTEGER', 'INTEGER or [INTEGER1:INTEGER2]','[INTEGER1:INTEGER2]', 'DOUBLE', '[DOUBLE DOUBLE]', '[INTEGER1 INTEGER2 ...]', ... + case {'INTEGER', 'INTEGER or [INTEGER1:INTEGER2]','[INTEGER1:INTEGER2]', 'DOUBLE', '[DOUBLE DOUBLE]', '[DOUBLE DOUBLE DOUBLE]', '[INTEGER1 INTEGER2 ...]', ... 'INTEGER or [INTEGER1:INTEGER2] or [INTEGER1 INTEGER2 ...]', '[INTEGER1:INTEGER2] or [INTEGER1 INTEGER2 ...]'} [num, status] = str2num(value); if strcmp(option_type,'[DOUBLE DOUBLE]') @@ -359,6 +360,11 @@ handles.pushbuttonReset = uicontrol( ... status = 0; end end + if strcmp(option_type,'[DOUBLE DOUBLE DOUBLE]') + if(size(num,1)~= 1 || size(num,2)~= 3) + status = 0; + end + end if strcmp(option_type,'[INTEGER1 INTEGER2 ...]') if(size(num,1)~= 1 || size(num,2) < 2) status = 0;