[R] correlated binary data and overall probability

Christian Lerch t.c.l at gmx.net
Sun Nov 8 20:32:23 CET 2009


To answer my own question:
The package mvtBinaryEP was helpful!

Christian Lerch schrieb:
> 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




More information about the R-help mailing list