From 0c7b4f542c6a8b41f0d9be928f898da5781ef306 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Wed, 6 May 2015 16:14:45 +0200 Subject: [PATCH] Add check for presence of NaN in JJ to identification_analysis.m Usually happens when model has a unit root and unconditional second moments are NaN --- matlab/identification_analysis.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/matlab/identification_analysis.m b/matlab/identification_analysis.m index 070698838..f14e74f71 100644 --- a/matlab/identification_analysis.m +++ b/matlab/identification_analysis.m @@ -85,6 +85,9 @@ if info(1)==0, derivatives_info.DYss=dYss; if init, indJJ = (find(max(abs(JJ'),[],1)>1.e-8)); + if isempty(indJJ) && any(any(isnan(JJ))) + error('There are NaN in the JJ matrix. Please check whether your model has units roots and you forgot to set lik_init~=1.' ) + end while length(indJJ)