[Depmix-commits] r458 - in pkg/depmixS4: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Apr 22 09:43:57 CEST 2011


Author: ingmarvisser
Date: 2011-04-22 09:43:57 +0200 (Fri, 22 Apr 2011)
New Revision: 458

Modified:
   pkg/depmixS4/NEWS
   pkg/depmixS4/R/EM.R
   pkg/depmixS4/R/depmix-class.R
   pkg/depmixS4/R/responseNORM.R
Log:
Fixed a bug in simulation of Gaussian response models (which was returning all nans).

Modified: pkg/depmixS4/NEWS
===================================================================
--- pkg/depmixS4/NEWS	2011-03-22 13:55:22 UTC (rev 457)
+++ pkg/depmixS4/NEWS	2011-04-22 07:43:57 UTC (rev 458)
@@ -1,4 +1,11 @@
 
+Changes in depmixS4 version 1.0-4
+
+  o Fixed a bug in simulation of gaussian response model, which was 
+    returning NaNs due to an error in assignment of the sd parameter
+   (introduced in version x). Thanks to Jeffrey Arnold for reporting
+   this (bug #1365). 
+
 Changes in depmixS4 version 1.0-3
 
   o Using AIC/BIC/logLik/nobs generics from stats/stats4 rather than 

Modified: pkg/depmixS4/R/EM.R
===================================================================
--- pkg/depmixS4/R/EM.R	2011-03-22 13:55:22 UTC (rev 457)
+++ pkg/depmixS4/R/EM.R	2011-04-22 07:43:57 UTC (rev 458)
@@ -51,7 +51,6 @@
 		
 	} else {
 		# initial expectation
-# 		fbo <- fb(init=object at init,matrix(0,1,1),B=object at dens,ntimes=ntimes(object),stationary=object at stationary)
 		B <- apply(object at dens,c(1,3),prod)
 		gamma <- object at init*B
 		LL <- sum(log(rowSums(gamma)))

Modified: pkg/depmixS4/R/depmix-class.R
===================================================================
--- pkg/depmixS4/R/depmix-class.R	2011-03-22 13:55:22 UTC (rev 457)
+++ pkg/depmixS4/R/depmix-class.R	2011-04-22 07:43:57 UTC (rev 458)
@@ -82,7 +82,7 @@
 		}
 		
 		# generate new mix.sim object
-		class(object) <- "mix.sim"
+		class(object) <- c("mix.sim")
 		object at states <- as.matrix(states)
 		
 		object at prior@x <- as.matrix(apply(object at prior@x,2,rep,nsim))
@@ -251,7 +251,7 @@
 		}
 		
 		# generate new depmix.sim object
-		class(object) <- "depmix.sim"
+		class(object) <- c("depmix.sim")
 		object at states <- as.matrix(states)
 		
 		object at prior@x <- as.matrix(apply(object at prior@x,2,rep,nsim))

Modified: pkg/depmixS4/R/responseNORM.R
===================================================================
--- pkg/depmixS4/R/responseNORM.R	2011-03-22 13:55:22 UTC (rev 457)
+++ pkg/depmixS4/R/responseNORM.R	2011-04-22 07:43:57 UTC (rev 458)
@@ -53,7 +53,7 @@
       mu <- predict(object)[times]
     }  
     nt <- length(mu)
-    sd <- getpars(object)["sd"]
+    sd <- object at parameters$sd
     response <- rnorm(nt*nsim,mean=mu,sd=sd)
     #if(nsim > 1) response <- matrix(response,ncol=nsim)
     response <- as.matrix(response)


More information about the depmix-commits mailing list