[Depmix-commits] r117 - trunk/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 2 18:38:37 CEST 2008


Author: maarten
Date: 2008-05-02 18:38:36 +0200 (Fri, 02 May 2008)
New Revision: 117

Modified:
   trunk/R/EM.R
   trunk/R/fb.R
Log:
corrected error (only in trunk version)

Modified: trunk/R/EM.R
===================================================================
--- trunk/R/EM.R	2008-03-27 22:27:52 UTC (rev 116)
+++ trunk/R/EM.R	2008-05-02 16:38:36 UTC (rev 117)
@@ -17,11 +17,11 @@
 	j <- 0
 	
 	A <- object at trDens
-# 	B <- apply(object at dens,c(1,3),prod)
+	B <- apply(object at dens,c(1,3),prod)
 	init <- object at init
 	
 	# initial expectation
-	fbo <- fb(init=object at init,A=object at trDens,B=object at dens,ntimes=ntimes(object))
+	fbo <- fb(init=object at init,A=object at trDens,B=apply(object at dens,c(1,3),prod),ntimes=ntimes(object))
 	LL <- fbo$logLike
 	LL.old <- LL + 1
 	
@@ -61,7 +61,7 @@
 		}
 		
 		# expectation
-		fbo <- fb(init=object at init,A=object at trDens,B=object at dens,ntimes=ntimes(object))
+		fbo <- fb(init=object at init,A=object at trDens,B=apply(object at dens,c(1,3),prod),ntimes=ntimes(object))
 		LL <- fbo$logLike
 				
 		if(verbose&((j%%5)==0)) cat("iteration",j,"logLik:",LL,"\n")

Modified: trunk/R/fb.R
===================================================================
--- trunk/R/fb.R	2008-03-27 22:27:52 UTC (rev 116)
+++ trunk/R/fb.R	2008-05-02 16:38:36 UTC (rev 117)
@@ -16,7 +16,7 @@
 
 	# NOTE: to prevent underflow, alpha and beta are scaled, using c
 	
-	# NOTE: xi[i,j] = P(S[t] = j & S[t+1] = i)
+	# NOTE: xi[t,i,j] = P(S[t] = j & S[t+1] = i)
 	
 	
 	B <- apply(B,c(1,3),prod)


More information about the depmix-commits mailing list