Skip to content

Commit

Permalink
wrap ekf call in try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
tholden committed Apr 3, 2019
1 parent 68d74b7 commit fdc0d0a
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions matlab/dsge_likelihood.m
Original file line number Diff line number Diff line change
Expand Up @@ -1037,13 +1037,28 @@
if DynareOptions.pruning
a = [ a; a_pruned1 ];
end

try

[LIK,lik,a,Pstar,rootPstar] = extended_kalman_filter(DatasetInfo.missing.aindex,DatasetInfo.missing.number_of_observations,DatasetInfo.missing.no_more_missing_observations,Y,diffuse_periods+1,size(Y,2), ...
a, rootPstar, ...
kalman_tol, DynareOptions.riccati_tol, ...
DynareOptions.rescale_prediction_error_covariance, ...
DynareOptions.presample, ...
EKFStateSelect,Constant,Jacobian0,Hessian,Q,H,Z,mm,pp,rr,Zflag,diffuse_periods);
[LIK,lik,a,Pstar,rootPstar] = extended_kalman_filter(DatasetInfo.missing.aindex,DatasetInfo.missing.number_of_observations,DatasetInfo.missing.no_more_missing_observations,Y,diffuse_periods+1,size(Y,2), ...
a, rootPstar, ...
kalman_tol, DynareOptions.riccati_tol, ...
DynareOptions.rescale_prediction_error_covariance, ...
DynareOptions.presample, ...
EKFStateSelect,Constant,Jacobian0,Hessian,Q,H,Z,mm,pp,rr,Zflag,diffuse_periods);

catch Error

disp( 'Error in Extended Kalman Filter:' );
disp( Error.message );

fval = Inf;
info(1) = 5116;
info(4) = 0.1;
exit_flag = 0;
return

end

else

Expand Down

0 comments on commit fdc0d0a

Please sign in to comment.