Make load_mh_file honor use_mh_covariance option

time-shift
Johannes Pfeifer 2021-01-20 10:20:18 +01:00
parent 78a4bca383
commit 32bdb82cf8
2 changed files with 24 additions and 19 deletions

View File

@ -425,7 +425,7 @@ options_.smoother = false;
options_.posterior_max_subsample_draws = 1200;
options_.sub_draws = [];
options_.ME_plot_tol=1e-6;
% options_.use_mh_covariance_matrix = 0;
options_.use_mh_covariance_matrix = false;
options_.gradient_method = 2; %used by csminwel and newrat
options_.gradient_epsilon = 1e-6; %used by csminwel and newrat
options_.posterior_sampler_options.sampling_opt = []; %extended set of options for individual posterior samplers

View File

@ -490,7 +490,8 @@ elseif options_.mh_recover
end
function [d,bayestopt_]=set_proposal_density_to_previous_value(record,options_,bayestopt_,d)
if isfield(record,'ProposalCovariance') && isfield(record,'ProposalCovariance')
if ~options_.use_mh_covariance_matrix
if isfield(record,'ProposalCovariance') && isfield(record,'ProposalScaleVec')
if isfield(record,'MCMC_sampler')
if ~strcmp(record.MCMC_sampler,options_.posterior_sampler_options.posterior_sampling_method)
error(fprintf('Estimation::mcmc: The posterior_sampling_method differs from the one of the original chain. Please reset it to %s',record.MCMC_sampler))
@ -511,3 +512,7 @@ else
end
end
end
else
% pass through input d unaltered
fprintf('Estimation::mcmc: use_mh_covariance_matrix specified, continuing with proposal density implied by the previous MCMC run.\n.');
end