Generate correlated random numbers from binomial distributions in R
问题 I am trying to find a way to generate correlated random numbers from several binomial distributions. I know how to do it with normal distributions (using mvrnorm), but I did not find a function applicable to binomial ones. 回答1: You can generate correlated uniforms using the copula package, then use the qbinom function to convert those to binomial variables. Here is one quick example: library(copula) tmp <- normalCopula( 0.75, dim=2 ) x <- rcopula(tmp, 1000) x2 <- cbind( qbinom(x[,1], 10, 0.5)