diff --git a/src/+gui_auxiliary/command_option_mapping.m b/src/+gui_auxiliary/command_option_mapping.m index 4ce87e9cda31b4c5344836d362a0e7e9d2958eb3..71ab7db010272ad93e3302997faa93c69775c1c9 100644 --- a/src/+gui_auxiliary/command_option_mapping.m +++ b/src/+gui_auxiliary/command_option_mapping.m @@ -64,10 +64,7 @@ switch name case 'mode_check_number_of_points' mapping = 'mode_check.number_of_points'; - - case 'optim' - mapping = 'optim_opt'; - + case 'mh_nblocks' mapping = 'mh_nblck'; @@ -80,15 +77,6 @@ switch name case 'geweke_interval' mapping = 'convergence.geweke.geweke_interval'; - case 'use_tarb' - mapping = 'TaRB.use_TaRB'; - - case 'tarb_new_block_probability' - mapping = 'TaRB.new_block_probability'; - - case 'tarb_mode_compute' - mapping = 'TaRB.mode_compute'; - case 'no_posterior_kernel_density' mapping = 'estimation.moments_posterior_density.indicator'; diff --git a/src/+gui_auxiliary/dynare_command_options_estimation.m b/src/+gui_auxiliary/dynare_command_options_estimation.m index bdcc007563fcc7ddea1b14b28241d44119fdce2d..ba7acffb377d0295a4ebfb22f15e7ed847713811 100644 --- a/src/+gui_auxiliary/dynare_command_options_estimation.m +++ b/src/+gui_auxiliary/dynare_command_options_estimation.m @@ -338,33 +338,16 @@ 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} = 'use_tarb'; -dynare_gui_.estimation.MH_options{num,2} = 0; -dynare_gui_.estimation.MH_options{num,3} = 'check_option'; -dynare_gui_.estimation.MH_options{num,4} = 'Instructs Dynare to use the Tailored randomized block (TaRB) Metropolis-Hastings algorithm proposed by Chib and Ramamurthy (2010) instead of the standard Random-Walk Metropolis-Hastings.'; +dynare_gui_.estimation.MH_options{num,1} = 'posterior_sampling_method'; +dynare_gui_.estimation.MH_options{num,2} = 'random_walk_metropolis_hastings'; +dynare_gui_.estimation.MH_options{num,3} = {'random_walk_metropolis_hastings', 'tailored_random_block_metropolis_hastings', 'independent_metropolis_hastings', 'slice'}; +dynare_gui_.estimation.MH_options{num,4} = 'Tells Dynare which sampler method should be used to sample from the posterior distribution during Bayesian estimation. The default setting is the standard Random-Walk Metropolis-Hastings. The following alternative methods are available: Tailored randomized block (TaRB) Metropolis-Hastings algorithm proposed by Chib and Ramamurthy (2010), Independent Metropolis-Hastings algorithm where the proposal distribution does not depend on the state of the chain, Slice sampler of Planas, Ratto, and Rossi (2015). (Note that [slice] is incompatible with prior_trunc=0.)'; num = num+1; -dynare_gui_.estimation.MH_options{num,1} = 'tarb_new_block_probability'; -dynare_gui_.estimation.MH_options{num,2} = '0.25'; -dynare_gui_.estimation.MH_options{num,3} = 'DOUBLE'; -dynare_gui_.estimation.MH_options{num,4} = 'Specifies the probability of the next parameter belonging to a new block when the random blocking in the TaRB Metropolis-Hastings algorithm is conducted. The higher this number, the smaller is the average block size and the more random blocks are formed during each parameter sweep. Default: 0.25.'; - -num = num+1; -dynare_gui_.estimation.MH_options{num,1} = 'tarb_mode_compute'; -dynare_gui_.estimation.MH_options{num,2} = '4'; -dynare_gui_.estimation.MH_options{num,3} = 'INTEGER'; -dynare_gui_.estimation.MH_options{num,4} = 'Specifies the mode-finder run in every iteration for every block of the TaRB Metropolis-Hastings algorithm. See [mode compute]. Default: 4.'; - -% There is no field in options_ structure for tarb_optim -% num = num+1; -% dynare_gui_.estimation.MH_options{num,1} = 'tarb_optim'; -% dynare_gui_.estimation.MH_options{num,2} = ''; -% dynare_gui_.estimation.MH_options{num,3} = 'INTEGER'; -% dynare_gui_.estimation.MH_options{num,4} = 'Specifies the options for the mode-finder used in the TaRB Metropolis-Hastings algorithm. See [optim].'; - - - - +dynare_gui_.estimation.MH_options{num,1} = 'posterior_sampler_options'; +dynare_gui_.estimation.MH_options{num,2} = ''; +dynare_gui_.estimation.MH_options{num,3} = '(NAME, VALUE, ...)'; % 'special' +dynare_gui_.estimation.MH_options{num,4} = 'A list of NAME and VALUE pairs. Can be used to set options for the posterior sampling methods. The set of available options depends on the selected samping routine (ie on the value of option [posterior_sampling_method]).'; %% Group 5: filter num = 1; diff --git a/src/+gui_auxiliary/set_command_option.m b/src/+gui_auxiliary/set_command_option.m index 77745f7225ef1ce160c7cc673eb8d4ffa9a7a674..c9883565316c074cd40a3d7006e7db0095582a62 100644 --- a/src/+gui_auxiliary/set_command_option.m +++ b/src/+gui_auxiliary/set_command_option.m @@ -108,14 +108,37 @@ try elseif value == 4 options_.(gui_auxiliary.command_option_mapping(name)) = 'FILENAME'; end - + case 'mcmc_jumping_covariance_file' if ~isempty(value) && strcmp(options_.MCMC_jumping_covariance, 'FILENAME') options_.MCMC_jumping_covariance = strrep(value, '.mat', ''); end + case 'mh_recover' + options_.mh_recover = logical(value); + + case 'posterior_sampling_method' + if value == 2 + options_.posterior_sampler_options.posterior_sampling_method = 'tailored_random_block_metropolis_hastings'; + elseif value == 3 + options_.posterior_sampler_options.posterior_sampling_method = 'independent_metropolis_hastings'; + elseif value == 4 + options_.posterior_sampler_options.posterior_sampling_method = 'slice'; + end + + case 'posterior_sampler_options' + options_.posterior_sampler_options.sampling_opt = value; + + case 'optim' + options_.optim_opt = value; + otherwise - options_.(gui_auxiliary.command_option_mapping(name)) = value; + if isnumeric(value) + eval(['options_.' gui_auxiliary.command_option_mapping(name) '=' num2str(value) ';']); + else + eval_expr = sprintf("options_.%s='%s';", gui_auxiliary.command_option_mapping(name), value); + eval(eval_expr); + end end catch status = 0;