Skip to content
Snippets Groups Projects
Commit cb81e4a9 authored by Stéphane Adjemian's avatar Stéphane Adjemian Committed by Sébastien Villemot
Browse files

Allow empty hessian in mode_check routine (options_.cova_compute==0)

(cherry picked from commit 6302abd7)
parent 16968cbf
No related branches found
No related tags found
No related merge requests found
...@@ -438,7 +438,11 @@ if ~options_.mh_posterior_mode_estimation && options_.cova_compute ...@@ -438,7 +438,11 @@ if ~options_.mh_posterior_mode_estimation && options_.cova_compute
end end
if options_.mode_check == 1 && ~options_.mh_posterior_mode_estimation && options_.cova_compute if options_.mode_check == 1 && ~options_.mh_posterior_mode_estimation && options_.cova_compute
if options_.cova_compute
mode_check(xparam1,0,hh,gend,data,lb,ub,data_index,number_of_observations,no_more_missing_observations); mode_check(xparam1,0,hh,gend,data,lb,ub,data_index,number_of_observations,no_more_missing_observations);
else
mode_check(xparam1,0,[],gend,data,lb,ub,data_index,number_of_observations,no_more_missing_observations);
end
end end
if ~options_.mh_posterior_mode_estimation && options_.cova_compute if ~options_.mh_posterior_mode_estimation && options_.cova_compute
......
...@@ -38,13 +38,17 @@ function mode_check(x,fval,hessian,gend,data,lb,ub,data_index,number_of_observat ...@@ -38,13 +38,17 @@ function mode_check(x,fval,hessian,gend,data,lb,ub,data_index,number_of_observat
global bayestopt_ M_ options_ global bayestopt_ M_ options_
TeX = options_.TeX; TeX = options_.TeX;
if ~isempty(hessian);
[ s_min, k ] = min(diag(hessian)); [ s_min, k ] = min(diag(hessian));
end
if options_.dsge_var if options_.dsge_var
fval = DsgeVarLikelihood(x,gend); fval = DsgeVarLikelihood(x,gend);
else else
fval = DsgeLikelihood(x,gend,data,data_index,number_of_observations,no_more_missing_observations); fval = DsgeLikelihood(x,gend,data,data_index,number_of_observations,no_more_missing_observations);
end end
bayestopt_.penalty=fval; bayestopt_.penalty=fval;
if ~isempty(hessian);
disp(' ') disp(' ')
disp('MODE CHECK') disp('MODE CHECK')
disp(' ') disp(' ')
...@@ -53,6 +57,7 @@ disp(' ') ...@@ -53,6 +57,7 @@ disp(' ')
if s_min<eps if s_min<eps
disp(sprintf('Most negative variance %f for parameter %d (%s = %f)', s_min, k , bayestopt_.name{k}, x(k))) disp(sprintf('Most negative variance %f for parameter %d (%s = %f)', s_min, k , bayestopt_.name{k}, x(k)))
end end
end
[nbplt,nr,nc,lr,lc,nstar] = pltorg(length(x)); [nbplt,nr,nc,lr,lc,nstar] = pltorg(length(x));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment