[Depmix-commits] r496 - pkg/depmixS4/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 25 14:41:38 CEST 2011


Author: ingmarvisser
Date: 2011-10-25 14:41:38 +0200 (Tue, 25 Oct 2011)
New Revision: 496

Modified:
   pkg/depmixS4/R/EM.R
Log:
Fixed a bug in the relative stopping criterion for EM (which resulted in no iterations in some cases with large positive loglikelihoods).

Modified: pkg/depmixS4/R/EM.R
===================================================================
--- pkg/depmixS4/R/EM.R	2011-10-24 20:15:16 UTC (rev 495)
+++ pkg/depmixS4/R/EM.R	2011-10-25 12:41:38 UTC (rev 496)
@@ -214,8 +214,8 @@
 				
 		if(verbose&((j%%5)==0)) cat("iteration",j,"logLik:",LL,"\n")
 		
-		if( (LL >= LL.old)) {
-		  if((crit == "absolute" &&  LL - LL.old < tol) || (crit == "relative" && (LL.old - LL)/LL.old  < tol)) {
+		if( (LL >= LL.old&j>25)) {
+		  if((crit == "absolute" &&  LL - LL.old < tol) || (crit == "relative" && abs((LL.old - LL)/LL.old)  < tol)) {
 			  cat("iteration",j,"logLik:",LL,"\n")
 			  converge <- TRUE
 			}



More information about the depmix-commits mailing list