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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 15 16:18:02 CEST 2012


Author: ingmarvisser
Date: 2012-06-15 16:18:01 +0200 (Fri, 15 Jun 2012)
New Revision: 522

Modified:
   pkg/depmixS4/R/depmixfit.R
   pkg/depmixS4/R/fb.R
   pkg/depmixS4/R/logLik.R
   pkg/depmixS4/R/lystig.R
Log:
Made argument name for argument stationary explicit in function call to fb from logLik as this was causing an error (...)
Changed default optimization criterion for donlp2 to 1e-6

Modified: pkg/depmixS4/R/depmixfit.R
===================================================================
--- pkg/depmixS4/R/depmixfit.R	2012-06-15 13:27:09 UTC (rev 521)
+++ pkg/depmixS4/R/depmixfit.R	2012-06-15 14:18:01 UTC (rev 522)
@@ -123,7 +123,7 @@
 				if(!reqdon) stop("Rdonlp2 not available.")
 				
 				# set donlp2 control parameters
-				cntrl <- donlp2.control(hessian=FALSE,difftype=2,report=TRUE)	
+				cntrl <- donlp2.control(hessian=FALSE,difftype=2,report=TRUE,epsx=1e-6)	
 				
 				mycontrol <- function(info) {
 					return(TRUE)

Modified: pkg/depmixS4/R/fb.R
===================================================================
--- pkg/depmixS4/R/fb.R	2012-06-15 13:27:09 UTC (rev 521)
+++ pkg/depmixS4/R/fb.R	2012-06-15 14:18:01 UTC (rev 522)
@@ -28,7 +28,8 @@
 	nt <- dim(B)[1]
 	ns <- ncol(init)
 	
-	if(na.allow) B <- replace(B,is.na(B) & !is.nan(B),1)
+	if(na.allow) B <- replace(B,is.na(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-15 13:27:09 UTC (rev 521)
+++ pkg/depmixS4/R/logLik.R	2012-06-15 14:18:01 UTC (rev 522)
@@ -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,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
+		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
 		attr(ll, "df") <- freepars(object)
 		attr(ll, "nobs") <- nobs(object)
 		class(ll) <- "logLik"

Modified: pkg/depmixS4/R/lystig.R
===================================================================
--- pkg/depmixS4/R/lystig.R	2012-06-15 13:27:09 UTC (rev 521)
+++ pkg/depmixS4/R/lystig.R	2012-06-15 14:18:01 UTC (rev 522)
@@ -17,7 +17,7 @@
 	# A = K*K matrix with transition probabilities, from column to row !!!!!!!
 	# change to T*K*K
     
-    if(na.allow) B <- replace(B,is.na(B),1)
+	if(na.allow) B <- replace(B,is.na(B),1)
 	B <- apply(B,c(1,3),prod)
 
 	# B = T*K*nresp matrix with elements ab_{tij} = P(y_t_i|s_j)



More information about the depmix-commits mailing list