Allow corner solution as starting point for MCMC

Bound is treated as admissible solution in previous steps like mode-finding, so it should be here, too
time-shift
Johannes Pfeifer 2016-04-01 13:12:21 +02:00
parent 7e56302a04
commit d737c7d1d8
1 changed files with 2 additions and 2 deletions

View File

@ -124,7 +124,7 @@ if ~options_.load_mh_file && ~options_.mh_recover
trial = 1;
while validate == 0 && trial <= 10
candidate = rand_multivariate_normal( transpose(xparam1), d * options_.mh_init_scale, npar);
if all(candidate(:) > mh_bounds.lb) && all(candidate(:) < mh_bounds.ub)
if all(candidate(:) >= mh_bounds.lb) && all(candidate(:) <= mh_bounds.ub)
ix2(j,:) = candidate;
ilogpo2(j) = - feval(TargetFun,ix2(j,:)',dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,mh_bounds,oo_);
if ~isfinite(ilogpo2(j)) % if returned log-density is
@ -167,7 +167,7 @@ if ~options_.load_mh_file && ~options_.mh_recover
else% Case 2: one chain (we start from the posterior mode)
fprintf(fidlog,[' Initial values of the parameters:\n']);
candidate = transpose(xparam1(:));%
if all(candidate(:) > mh_bounds.lb) && all(candidate(:) < mh_bounds.ub)
if all(candidate(:) >= mh_bounds.lb) && all(candidate(:) <= mh_bounds.ub)
ix2 = candidate;
ilogpo2 = - feval(TargetFun,ix2',dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,mh_bounds,oo_);
disp('Estimation::mcmc: Initialization at the posterior mode.')