bug fix: with option mh_initialize_from_previous_mcmc, we need also to check if some prior changed, which may lead last draw in previous mcmc falling outside new prior bounds.

mr#2177
Marco Ratto 2023-07-19 08:55:13 +02:00
parent de152a3de3
commit aad5c36081
1 changed files with 6 additions and 0 deletions

View File

@ -171,6 +171,12 @@ if ~options_.load_mh_file && ~options_.mh_recover
ilogpo2 = zeros(NumberOfBlocks,1);
ilogpo2(:,1) = record0.LastLogPost;
ix2(:,IA) = record0.LastParameters(:,IB);
for j=1:NumberOfBlocks
if not(all(ix2(j,:)' >= mh_bounds.lb) && all(ix2(j,:)' <= mh_bounds.ub))
new_estimated_parameters = logical(new_estimated_parameters + (ix2(j,:)' < mh_bounds.lb));
new_estimated_parameters = logical(new_estimated_parameters + (ix2(j,:)' > mh_bounds.ub));
end
end
else
new_estimated_parameters = true(1,npar);
end