Skip to content
Snippets Groups Projects
Commit 61632ef2 authored by Marco Ratto's avatar Marco Ratto Committed by Johannes Pfeifer
Browse files

marginal_density.m: make computation of log(det(sigma)) robust numerically

parent 48ec0a60
Branches
No related tags found
1 merge request!2042Fixes for PKF, marginal density, plot_shock_decomposition
......@@ -69,7 +69,14 @@ parameter_names = bayestopt_.name;
save([M_.dname filesep 'Output' filesep M_.fname '_mean.mat'],'xparam1','hh','parameter_names','SIGMA');
fprintf('Estimation::marginal density: I''m computing the posterior log marginal density (modified harmonic mean)... ');
logdetSIGMA = log(det(SIGMA));
try
% use this robust option to avoid inf/nan
logdetSIGMA = 2*sum(log(diag(chol(SIGMA))));
catch
% in case SIGMA is not positive definite
logdetSIGMA = nan;
fprintf('Estimation::marginal density: the covariance of MCMC draws is not positive definite. You may have too few MCMC draws.');
end
invSIGMA = hh;
marginal = zeros(9,2);
linee = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment