From 33aa22a80f203e6e1d61c5f17b0a35d8b0ed32b2 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Sun, 11 Oct 2015 10:49:15 +0200 Subject: [PATCH] Condition check for stochastic singularity on maximum of non-missing observations closes #1071 --- matlab/initial_estimation_checks.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/matlab/initial_estimation_checks.m b/matlab/initial_estimation_checks.m index 642023e0ad..dff2d4dfec 100644 --- a/matlab/initial_estimation_checks.m +++ b/matlab/initial_estimation_checks.m @@ -36,11 +36,15 @@ function DynareResults = initial_estimation_checks(objective_function,xparam1,Dy % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. -if DynareDataset.vobs>Model.exo_nbr+EstimatedParameters.nvn +%get maximum number of simultaneously observed variables for stochastic +%singularity check +maximum_number_non_missing_observations=max(sum(~isnan(DynareDataset.data),2)); + +if maximum_number_non_missing_observations>Model.exo_nbr+EstimatedParameters.nvn error(['initial_estimation_checks:: Estimation can''t take place because there are less declared shocks than observed variables!']) end -if DynareDataset.vobs>length(find(diag(Model.Sigma_e)))+EstimatedParameters.nvn +if maximum_number_non_missing_observations>length(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 -- GitLab