[Depmix-commits] r453 - pkg/depmixS4/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Feb 15 14:24:16 CET 2011
Author: ingmarvisser
Date: 2011-02-15 14:24:16 +0100 (Tue, 15 Feb 2011)
New Revision: 453
Modified:
pkg/depmixS4/R/responseGLMBINOM.R
Log:
Fixed a bug in simulation of binomial responses.
Modified: pkg/depmixS4/R/responseGLMBINOM.R
===================================================================
--- pkg/depmixS4/R/responseGLMBINOM.R 2011-01-25 14:48:16 UTC (rev 452)
+++ pkg/depmixS4/R/responseGLMBINOM.R 2011-02-15 13:24:16 UTC (rev 453)
@@ -40,13 +40,15 @@
pr <- predict(object)[times,]
}
nt <- nrow(pr)
+ n <- rowSums(object at y)
if(NCOL(object at y) == 2) {
- response <- rbinom(nt*nsim,size=object at y[,2],prob=pr)
+ response <- rbinom(nt*nsim,size=n,prob=pr)
+ response <- cbind(response,n-response)
} else {
response <- rbinom(nt*nsim,size=1,prob=pr)
}
#if(nsim > 1) response <- matrix(response,ncol=nsim)
- response <- as.matrix(response)
+ response <- as.matrix(response)
return(response)
}
)
More information about the depmix-commits
mailing list