[R] correlated binary data and overall probability
Christian Lerch
t.c.l at gmx.net
Thu Oct 29 10:55:24 CET 2009
Dear All,
I try to simulate correlated binary data for a clinical research project.
Unfortunately, I do not come to grips with bindata().
Consider
corr<-data.frame(ID=as.factor(rep(c(1:10), each=5)),
task=as.factor(rep(c(1:5),10)))
[this format might be more appropriate:]
corr2<-data.frame(ID=as.factor(rep(c(1:10),5)),
tablet=as.factor(rep(c(1:5),each=10)))
Now, I want to add one column 'outcome' for the binary response:
* within each 'task', the probabilty of success (1) is fixed, (say rbinom(x,1,0.7))
* within each 'ID', the outcomes are correlated (say 0.8)
How can I generate this column 'outcome' with the given proporties?
Many thanks for hints or even code!
Regards,
Christian
--
http://portal.gmx.net/de/go/dsl02
More information about the R-help
mailing list