Filter out infinite likelihoods

time-shift
Johannes Pfeifer 2016-06-14 17:28:52 +02:00 committed by Stéphane Adjemian (Hermes)
parent 818befd4eb
commit 39e7c39243
4 changed files with 28 additions and 1 deletions

View File

@ -660,7 +660,7 @@ end
%------------------------------------------------------------------------------ %------------------------------------------------------------------------------
singularity_has_been_detected = false; singularity_has_been_detected = false;
% First test multivariate filter if specified; potentially abort and use univariate filter instead
if ((kalman_algo==1) || (kalman_algo==3))% Multivariate Kalman Filter if ((kalman_algo==1) || (kalman_algo==3))% Multivariate Kalman Filter
if no_missing_data_flag if no_missing_data_flag
if DynareOptions.block if DynareOptions.block
@ -824,6 +824,14 @@ if imag(LIK)~=0
return return
end end
if isinf(LIK)~=0
fval = Inf;
info(1) = 50;
info(4) = 0.1;
exit_flag = 0;
return
end
likelihood = LIK; likelihood = LIK;
% ------------------------------------------------------------------------------ % ------------------------------------------------------------------------------

View File

@ -308,6 +308,14 @@ if imag(fval)~=0
return return
end end
if isinf(fval)~=0
fval = Inf;
info(1) = 50;
info(4) = 0.1;
exit_flag = 0;
return
end
if (nargout >= 10) if (nargout >= 10)
if isinf(dsge_prior_weight) if isinf(dsge_prior_weight)
iXX = iGXX; iXX = iGXX;

View File

@ -367,3 +367,12 @@ if imag(fval)~=0
exit_flag = 0; exit_flag = 0;
return return
end end
if isinf(LIK)~=0
fval = Inf;
info(1) = 50;
info(4) = 0.1;
exit_flag = 0;
return
end

View File

@ -116,6 +116,8 @@ if ~noprint
error('Prior density is a complex number'); error('Prior density is a complex number');
case 49 case 49
error('The model violates one (many) endogenous prior restriction(s)') error('The model violates one (many) endogenous prior restriction(s)')
case 50
error('Likelihood is Inf')
case 51 case 51
fprintf('\n The dsge_prior_weight is dsge_var=%5.4f, but must be at least %5.4f for the prior to be proper.\n',info(2),info(3)); fprintf('\n The dsge_prior_weight is dsge_var=%5.4f, but must be at least %5.4f for the prior to be proper.\n',info(2),info(3));
error('You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!') error('You are estimating a DSGE-VAR model, but the value of the dsge prior weight is too low!')