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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 15 13:32:12 CEST 2012


Author: maarten
Date: 2012-06-15 13:32:12 +0200 (Fri, 15 Jun 2012)
New Revision: 519

Modified:
   pkg/depmixS4/R/fb.R
   pkg/depmixS4/R/logLik.R
Log:
- in fb, missing cases are now only NA, not NaN
- in logLik, default method is now "fb" (for speed as this is implemented in C)

Modified: pkg/depmixS4/R/fb.R
===================================================================
--- pkg/depmixS4/R/fb.R	2012-06-14 18:46:05 UTC (rev 518)
+++ pkg/depmixS4/R/fb.R	2012-06-15 11:32:12 UTC (rev 519)
@@ -28,7 +28,7 @@
 	nt <- dim(B)[1]
 	ns <- ncol(init)
 	
-	if(na.allow) B <- replace(B,is.na(B),1)
+	if(na.allow) B <- replace(B,is.na(B) & !is.nan(B),1)
 	B <- apply(B,c(1,3),prod)
 	
 	if(is.null(ntimes)) ntimes <- nt

Modified: pkg/depmixS4/R/logLik.R
===================================================================
--- pkg/depmixS4/R/logLik.R	2012-06-14 18:46:05 UTC (rev 518)
+++ pkg/depmixS4/R/logLik.R	2012-06-15 11:32:12 UTC (rev 519)
@@ -1,6 +1,7 @@
 # depends on getpars and nobs
 setMethod("logLik",signature(object="depmix"),
-	function(object,method="lystig") { 
+	#function(object,method="lystig") { 
+	function(object,method="fb") { #4/5/2012: set to fb as this is now in C
 		if(method=="fb") ll <- fb(object at init,object at trDens,object at dens,object at ntimes,object at stationary)$logLike
 		if(method=="lystig") ll <- lystig(object at init,object at trDens,object at dens,object at ntimes,object at stationary)$logLike
 		attr(ll, "df") <- freepars(object)
@@ -12,7 +13,8 @@
 
 # depends on getpars and nobs
 setMethod("logLik",signature(object="mix"),
-	function(object,method="lystig") { 
+	#function(object,method="lystig") { 
+	function(object,method="fb") { 
 		if(method=="fb") ll <- fb(object at init,matrix(0,1,1),object at dens,object at ntimes,TRUE)$logLike
 		if(method=="lystig") ll <- lystig(object at init,matrix(0,1,1),object at dens,object at ntimes,TRUE)$logLike
 		attr(ll, "df") <- freepars(object)
@@ -20,4 +22,4 @@
 		class(ll) <- "logLik"
 		ll
 	}
-)
\ No newline at end of file
+)



More information about the depmix-commits mailing list