Commit 59a1c1c8 authored by Marco Ratto's avatar Marco Ratto
Browse files

new option maximize_using_mh_bounds for slice

parent 7a834901
......@@ -304,6 +304,10 @@ if init
case 'maximize'
posterior_sampler_options.maximize = options_list{i,2};
case 'maximize_using_mh_bounds'
posterior_sampler_options.maximize_using_mh_bounds = options_list{i,2};
case 'mode_compute'
posterior_sampler_options.mode_compute = options_list{i,2};
......@@ -431,6 +435,22 @@ if strcmp(posterior_sampler_options.posterior_sampling_method,'slice')
posterior_sampler_options.invhess=[];
end
end
if posterior_sampler_options.maximize_using_mh_bounds && options_.load_mh_file && not(options_.mh_recover)
global M_ bayestopt_
[ ~, params0 ] = get_posterior_sample('param', [], M_, bayestopt_ ); % loads posterior params in params0
mh_replic=size(params0,1)/options_.mh_nblck;
retain=[];
for k=1:options_.mh_nblck
retain=[retain; [options_.mh_drop*mh_replic+1+(k-1)*mh_replic:k*mh_replic]'];
end
params1=params0(retain,:);
opt_bounds.lb=min(params1)';
opt_bounds.ub=max(params1)';
opt_bounds.lb=max(min(opt_bounds.lb.*0.99,opt_bounds.lb-1.e-6),0.5*(opt_bounds.lb+posterior_sampler_options.bounds.lb));
opt_bounds.ub=min(max(opt_bounds.ub.*1.01,opt_bounds.ub+1.e-6),0.5*(opt_bounds.ub+posterior_sampler_options.bounds.ub));
posterior_sampler_options.bounds = opt_bounds;
end
% needs to be re-set to zero otherwise posterior analysis is filtered
% out in dynare_estimation_1.m
options_.mh_posterior_mode_estimation = false;
......
......@@ -465,6 +465,7 @@ options_.posterior_sampler_options.slice.WR=[];
options_.posterior_sampler_options.slice.mode_files=[];
options_.posterior_sampler_options.slice.mode=[];
options_.posterior_sampler_options.slice.maximize=0;
options_.posterior_sampler_options.slice.maximize_using_mh_bounds=0;
options_.posterior_sampler_options.slice.mode_compute=5;
options_.posterior_sampler_options.slice.initial_step_size=0.8;
options_.posterior_sampler_options.slice.save_tmp_file=1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment