From db972fea4e1cfe86e0f8ab93a365694e65c2bbd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Thu, 14 Jun 2012 14:49:10 +0200
Subject: [PATCH] Consider the effective number of structural innovations in
 initial_estimation_checks routine. Some of the declared structural
 innovations may have been calibrated with a zero variance. (cherry picked
 from commit 1763855225f4bbda8a71d3d3f3ef8f9074c254d3)

---
 matlab/initial_estimation_checks.m | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/matlab/initial_estimation_checks.m b/matlab/initial_estimation_checks.m
index 91b59e6e3..08926fae8 100644
--- a/matlab/initial_estimation_checks.m
+++ b/matlab/initial_estimation_checks.m
@@ -31,7 +31,11 @@ function DynareResults = initial_estimation_checks(objective_function,xparam1,Dy
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
 if DynareDataset.info.nvobs>Model.exo_nbr+EstimatedParameters.nvn
-    error(['initial_estimation_checks:: Estimation can''t take place because there are less shocks than observed variables!'])
+    error(['initial_estimation_checks:: Estimation can''t take place because there are less declared shocks than observed variables!'])
+end
+
+if DynareDataset.info.nvobs>find(diag(Model.Sigma_e))+EstimatedParameters.nvn
+    error(['initial_estimation_checks:: Estimation can''t take place because too many shocks have been calibrated with a zero variance!'])
 end
 
 % check if steady state solves static model (except if diffuse_filter == 1)
-- 
GitLab