[R] Generate bivariate binomial data

Christian Ritz ritz at life.ku.dk
Fri Apr 17 17:55:51 CEST 2009


Hi Thierry,

I think it should be possible to generate such correlated data using a mixed model approach:


1) Generate pairs of correlated linear predictor values using an ordinary linear mixed
model setup (for example using rnorm() repeatedly)

2) Back-transform these values using the inverse logit (or similar link function) to
obtain probabilities

3) Draw binomial responses using the probabilities from 2) (using rbinom())


You may need to use trial-and-error to get the right amount of correlation.


Christian




More information about the R-help mailing list