rusers.sh
2010-Aug-24 01:40 UTC
[R] generate random numbers from a multivariate distribution with specified correlation matrix
Hi all, rmvnorm()can be used to generate the random numbers from a multivariate normal distribution with specified means and covariance matrix, but i want to specify the correlation matrix instead of covariance matrix for the multivariate normal distribution. Does anybody know how to generate the random numbers from a multivariate normal distribution with specified correlation matrix? What about other non-normal distribution? Thanks a lot. -- ----------------- Jane Chang Queen's [[alternative HTML version deleted]]
Ben Bolker
2010-Aug-24 02:43 UTC
[R] generate random numbers from a multivariate distribution with specified correlation matrix
rusers.sh <rusers.sh <at> gmail.com> writes:> rmvnorm()can be used to generate the random numbers from a multivariate > normal distribution with specified means and covariance matrix, but i want > to specify the correlation matrix instead of covariance matrix for the > multivariate > normal distribution. > Does anybody know how to generate the random numbers from a multivariate > normal distribution with specified correlation matrix? What about > other non-normal > distribution?What do you want the variances to be? If you don't mind that they're all equal to 1, then using your correlation matrix as the Sigma argument to the mvrnorm() [sic] function in MASS should work fine. They have to be defined as *something* .... If you want multivariate distributions with non-normal marginal distributions, consider the 'copula' package, but be prepared to do some reading -- this is a fairly big/deep topic. good luck.
rusers.sh
2010-Aug-24 16:54 UTC
[R] generate random numbers from a multivariate distribution with specified correlation matrix
Great. It is more clearer for me. Thanks all. 2010/8/24 Michael Dewey <med@aghmed.fsnet.co.uk>> At 02:40 24/08/2010, rusers.sh wrote: > >> Hi all, >> rmvnorm()can be used to generate the random numbers from a multivariate >> normal distribution with specified means and covariance matrix, but i want >> to specify the correlation matrix instead of covariance matrix for the >> multivariate >> normal distribution. >> > > Jane, perhaps I misunderstand you but the correlation matrix is a > covariance matrix > > > Does anybody know how to generate the random numbers from a multivariate >> normal distribution with specified correlation matrix? What about >> other non-normal >> distribution? >> > > There is corcounts for correlated count variables and a couple of packages > for correlated binary variables, search the packages list for correlated for > details. I have not used any of these so can offer no recommendations. > > Thanks a lot. >> >> -- >> ----------------- >> Jane Chang >> Queen's >> >> [[alternative HTML version deleted]] >> > > Michael Dewey > med@aghmed.fsnet.co.uk > http://www.aghmed.fsnet.co.uk/home.html > >-- ----------------- Jane Chang Queen's [[alternative HTML version deleted]]
rusers.sh
2010-Aug-24 17:17 UTC
[R] generate random numbers from a multivariate distribution with specified correlation matrix
BTW, can you recommend a book on statistical simulations? I want to know more on how to generate random numbers from distributions, how to generate the theoretical models,... Thanks a lot. 2010/8/24 Michael Dewey <med@aghmed.fsnet.co.uk>> At 02:40 24/08/2010, rusers.sh wrote: > >> Hi all, >> rmvnorm()can be used to generate the random numbers from a multivariate >> normal distribution with specified means and covariance matrix, but i want >> to specify the correlation matrix instead of covariance matrix for the >> multivariate >> normal distribution. >> > > Jane, perhaps I misunderstand you but the correlation matrix is a > covariance matrix > > > Does anybody know how to generate the random numbers from a multivariate >> normal distribution with specified correlation matrix? What about >> other non-normal >> distribution? >> > > There is corcounts for correlated count variables and a couple of packages > for correlated binary variables, search the packages list for correlated for > details. I have not used any of these so can offer no recommendations. > > Thanks a lot. >> >> -- >> ----------------- >> Jane Chang >> Queen's >> >> [[alternative HTML version deleted]] >> > > Michael Dewey > med@aghmed.fsnet.co.uk > http://www.aghmed.fsnet.co.uk/home.html > >-- ----------------- Jane Chang Queen's [[alternative HTML version deleted]]