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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 15 16:37:53 CEST 2012


Author: maarten
Date: 2012-06-15 16:37:52 +0200 (Fri, 15 Jun 2012)
New Revision: 523

Modified:
   pkg/depmixS4/R/fb.R
   pkg/depmixS4/R/logLik.R
Log:
- changed back to only change NA to 1 in B (and not NaN) in "fb" 
- using explicit argument calls in logLik

Modified: pkg/depmixS4/R/fb.R
===================================================================
--- pkg/depmixS4/R/fb.R	2012-06-15 14:18:01 UTC (rev 522)
+++ pkg/depmixS4/R/fb.R	2012-06-15 14:37:52 UTC (rev 523)
@@ -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.na(B),1)
 
 	B <- apply(B,c(1,3),prod)
 	

Modified: pkg/depmixS4/R/logLik.R
===================================================================
--- pkg/depmixS4/R/logLik.R	2012-06-15 14:18:01 UTC (rev 522)
+++ pkg/depmixS4/R/logLik.R	2012-06-15 14:37:52 UTC (rev 523)
@@ -2,8 +2,8 @@
 setMethod("logLik",signature(object="depmix"),
 	#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,stationary=object at stationary)$logLike
-		if(method=="lystig") ll <- lystig(object at init,object at trDens,object at dens,object at ntimes,stationary=object at stationary)$logLike
+		if(method=="fb") ll <- fb(init=object at init,A=object at trDens,B=object at dens,ntimes=object at ntimes,stationary=object at stationary)$logLike
+		if(method=="lystig") ll <- lystig(init=object at init,A=object at trDens,B=object at dens,ntimes=object at ntimes,stationary=object at stationary)$logLike
 		attr(ll, "df") <- freepars(object)
 		attr(ll, "nobs") <- nobs(object)
 		class(ll) <- "logLik"
@@ -15,8 +15,8 @@
 setMethod("logLik",signature(object="mix"),
 	#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
+		if(method=="fb") ll <- fb(init=object at init,A=matrix(0,1,1),B=object at dens,ntimes=object at ntimes,stationary=TRUE)$logLike
+		if(method=="lystig") ll <- lystig(init=object at init,A=matrix(0,1,1),B=object at dens,ntimes=object at ntimes,stationary=TRUE)$logLike
 		attr(ll, "df") <- freepars(object)
 		attr(ll, "nobs") <- nobs(object)
 		class(ll) <- "logLik"



More information about the depmix-commits mailing list