Skip to content
Snippets Groups Projects
Commit ea103ecb authored by Stéphane Adjemian's avatar Stéphane Adjemian Committed by Stéphane Adjemian (Scylla)
Browse files

Do not compute marginal density (Laplace approximation) if options_.cova_compute==1.

parent 26a4a011
Branches
Tags
No related merge requests found
...@@ -569,6 +569,7 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation ...@@ -569,6 +569,7 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
end end
end end
%% Laplace approximation to the marginal log density: %% Laplace approximation to the marginal log density:
if options_.cova_compute
estim_params_nbr = size(xparam1,1); estim_params_nbr = size(xparam1,1);
scale_factor = -sum(log10(diag(invhess))); scale_factor = -sum(log10(diag(invhess)));
log_det_invhess = -estim_params_nbr*log(scale_factor)+log(det(scale_factor*invhess)); log_det_invhess = -estim_params_nbr*log(scale_factor)+log(det(scale_factor*invhess));
...@@ -583,6 +584,7 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation ...@@ -583,6 +584,7 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
disp(' ') disp(' ')
disp(sprintf('Log data density [Laplace approximation] is %f.',md_Laplace)) disp(sprintf('Log data density [Laplace approximation] is %f.',md_Laplace))
disp(' ') disp(' ')
end
elseif ~any(bayestopt_.pshape > 0) && options_.mh_posterior_mode_estimation elseif ~any(bayestopt_.pshape > 0) && options_.mh_posterior_mode_estimation
disp(' ') disp(' ')
disp('RESULTS FROM MAXIMUM LIKELIHOOD') disp('RESULTS FROM MAXIMUM LIKELIHOOD')
...@@ -868,12 +870,16 @@ if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ... ...@@ -868,12 +870,16 @@ if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
if options_.load_mh_file && options_.use_mh_covariance_matrix if options_.load_mh_file && options_.use_mh_covariance_matrix
invhess = compute_mh_covariance_matrix; invhess = compute_mh_covariance_matrix;
end end
if options_.cova_compute
if options_.dsge_var if options_.dsge_var
feval(options_.posterior_sampling_method,'DsgeVarLikelihood',options_.proposal_distribution,xparam1,invhess,bounds,gend); feval(options_.posterior_sampling_method,'DsgeVarLikelihood',options_.proposal_distribution,xparam1,invhess,bounds,gend);
else else
feval(options_.posterior_sampling_method,'DsgeLikelihood',options_.proposal_distribution,xparam1,invhess,bounds,gend,data,... feval(options_.posterior_sampling_method,'DsgeLikelihood',options_.proposal_distribution,xparam1,invhess,bounds,gend,data,...
data_index,number_of_observations,no_more_missing_observations); data_index,number_of_observations,no_more_missing_observations);
end end
else
error('I Cannot start the MCMC because the hessian of the posterior kernel at the mode was not computed.')
end
end end
if options_.mh_posterior_mode_estimation if options_.mh_posterior_mode_estimation
CutSample(M_, options_, estim_params_); CutSample(M_, options_, estim_params_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment