Re: [R] Correlated Multivariate Distribution Generator

2011-07-27 Thread Enrico Schumann
t; Von: Yue Yu [mailto:parn...@gmail.com] > Gesendet: Mittwoch, 27. Juli 2011 21:18 > An: enricoschum...@yahoo.de; Doran, Harold > Cc: r-help@r-project.org > Betreff: Re: [R] Correlated Multivariate Distribution Generator > > Thanks, Enrico and Harold. > > I have searched t

Re: [R] Correlated Multivariate Distribution Generator

2011-07-27 Thread Yue Yu
Thanks, Enrico and Harold. I have searched the archives for this topic, but all I can find is about the multivariate normal or uniform generator, which doesn't help in my case. Harold's transformation is good for getting the correlation, but the negative binomial distribution will be changed afte

Re: [R] Correlated Multivariate Distribution Generator

2011-07-27 Thread Doran, Harold
Do you mean something like this? > cors <- matrix(c(1, .9, .8, .8, .9, 1, .8, .8, .8, .8, 1, .9, .8, .8, .9, 1), > 4) > L <- chol(cors) > N <- 1000 > dat <- cbind(rnbinom(N, mu = 4, size = 1), rnbinom(N, mu = 4, size = 1), > rnbinom(N, mu = 4, size = 1), rnbinom(N, mu = 4, size = 1)) > result <-

Re: [R] Correlated Multivariate Distribution Generator

2011-07-27 Thread Enrico Schumann
Hi Yue Yu, similar questions have been discussed several times on this list; you may want to search the archives. Do you mean linear correlation, or rank correlation? In general, a given linear correlation will not always be attainable (though in your case, it probably will). If _rank_ correlati