[Depmix-commits] r127 - trunk/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 20 11:30:41 CEST 2008
Author: maarten
Date: 2008-05-20 11:30:40 +0200 (Tue, 20 May 2008)
New Revision: 127
Modified:
trunk/R/simulate.r
Log:
-fixed bug in simulate.r
Modified: trunk/R/simulate.r
===================================================================
--- trunk/R/simulate.r 2008-05-20 07:31:27 UTC (rev 126)
+++ trunk/R/simulate.r 2008-05-20 09:30:40 UTC (rev 127)
@@ -35,10 +35,10 @@
}
responses <- array("numeric",dim=c(nt,nresp,nsim))
- for(j in 1:resp(object)) {
+ for(i in 1:resp(object)) {
tmp <- array(,dim=c(nt,ns,nsim))
for(j in 1:ns) {
- tmp[,j,] <- simulate(object at response[[j]][[i]],n=nt)
+ tmp[,j,] <- simulate(object at response[[j]][[i]],nsim=nt*nsim)
}
for(j in 1:nsim) {
responses[,i,j] <- tmp[cbind(1:nt,states[,j],j)]
@@ -80,11 +80,11 @@
# draw in one go
mu <- predict(object)
sd <- getpars(object)["sd"]
- response <- rnorm(nsim,mean=mu,sd=sd)
+ response <- rnorm(nt*nsim,mean=mu,sd=sd)
} else {
mu <- predict(object)[time]
sd <- getpars(object)["sd"]
- response <- rnorm(nsim,mean=mu,sd=sd)
+ response <- rnorm(length(time)*nsim,mean=mu,sd=sd)
}
}
)
More information about the depmix-commits
mailing list