Allow empty hessian in mode_check routine (options_.cova_compute==0)
parent
bd012c458f
commit
6302abd7bd
|
@ -444,7 +444,11 @@ if ~options_.mh_posterior_mode_estimation && options_.cova_compute
|
|||
end
|
||||
|
||||
if options_.mode_check == 1 && ~options_.mh_posterior_mode_estimation && options_.cova_compute
|
||||
mode_check(xparam1,0,hh,gend,data,lb,ub,data_index,number_of_observations,no_more_missing_observations);
|
||||
if options_.cova_compute
|
||||
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
|
||||
|
||||
if ~options_.mh_posterior_mode_estimation && options_.cova_compute
|
||||
|
|
|
@ -38,20 +38,25 @@ function mode_check(x,fval,hessian,gend,data,lb,ub,data_index,number_of_observat
|
|||
global bayestopt_ M_ options_
|
||||
|
||||
TeX = options_.TeX;
|
||||
[ s_min, k ] = min(diag(hessian)) ;
|
||||
if ~isempty(hessian);
|
||||
[ s_min, k ] = min(diag(hessian));
|
||||
end
|
||||
if options_.dsge_var
|
||||
fval = DsgeVarLikelihood(x,gend);
|
||||
else
|
||||
fval = DsgeLikelihood(x,gend,data,data_index,number_of_observations,no_more_missing_observations);
|
||||
end
|
||||
bayestopt_.penalty=fval;
|
||||
disp(' ')
|
||||
disp('MODE CHECK')
|
||||
disp(' ')
|
||||
disp(sprintf('Fval obtained by the minimization routine: %f', fval))
|
||||
disp(' ')
|
||||
if s_min<eps
|
||||
disp(sprintf('Most negative variance %f for parameter %d (%s = %f)', s_min, k , bayestopt_.name{k}, x(k)))
|
||||
bayestopt_.penalty=fval;
|
||||
|
||||
if ~isempty(hessian);
|
||||
disp(' ')
|
||||
disp('MODE CHECK')
|
||||
disp(' ')
|
||||
disp(sprintf('Fval obtained by the minimization routine: %f', fval))
|
||||
disp(' ')
|
||||
if s_min<eps
|
||||
disp(sprintf('Most negative variance %f for parameter %d (%s = %f)', s_min, k , bayestopt_.name{k}, x(k)))
|
||||
end
|
||||
end
|
||||
|
||||
[nbplt,nr,nc,lr,lc,nstar] = pltorg(length(x));
|
||||
|
|
Loading…
Reference in New Issue