Add check for positive definiteness of Sigma_u^star
Otherwise, complex likelihoods may occurtime-shift
parent
d0682bca30
commit
52a082a1f9
|
@ -233,6 +233,15 @@ assignin('base','GYX',GYX);
|
|||
iGXX = inv(GXX);
|
||||
PHI_star = iGXX*transpose(GYX); %formula (22), DS (2004)
|
||||
SIGMA_u_star=GYY - GYX*PHI_star; %formula (23), DS (2004)
|
||||
[SIGMA_u_star_is_positive_definite, penalty] = ispd(SIGMA_u_star);
|
||||
if ~SIGMA_u_star_is_positive_definite
|
||||
fval = Inf;
|
||||
info(1) = 53;
|
||||
info(4) = penalty;
|
||||
exit_flag = 0;
|
||||
return;
|
||||
end
|
||||
|
||||
if ~isinf(dsge_prior_weight)% Evaluation of the likelihood of the dsge-var model when the dsge prior weight is finite.
|
||||
tmp0 = dsge_prior_weight*NumberOfObservations*TheoreticalAutoCovarianceOfTheObservedVariables(:,:,1) + mYY ; %first term of square bracket in formula (29), DS (2004)
|
||||
tmp1 = dsge_prior_weight*NumberOfObservations*GYX + mYX; %first element of second term of square bracket in formula (29), DS (2004)
|
||||
|
|
|
@ -122,7 +122,9 @@ if ~noprint
|
|||
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!')
|
||||
case 52 %dsge_var_likelihood
|
||||
error('You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations is not positive definite!');
|
||||
error('You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations, based on artificial and actual sample is not positive definite!');
|
||||
case 53 %dsge_var_likelihood
|
||||
error('You are estimating a DSGE-VAR model, but the implied covariance matrix of the VAR''s innovations, based on the artificial sample, is not positive definite!');
|
||||
case 55
|
||||
error('Fast Kalman filter only works with stationary models [lik_init=1] or stationary observables for non-stationary models [lik_init=3]')
|
||||
case 61 %Discretionary policy
|
||||
|
|
Loading…
Reference in New Issue