Re: [R] How to simulate correlated data

From: Berwin A Turlach <berwin_at_maths.uwa.edu.au>
Date: Fri 16 Dec 2005 - 02:50:13 EST

G'day Lisa,

>>>>> "LW" == Lisa Wang <lisawang@uhnres.utoronto.ca> writes:

    LW> I would like to simulate X --Normal (20, 5) Y-- Normal (40,     LW> 10) and the correlation between X and Y is 0.6.

    LW> How do I do it in R?
That depends on what you want the joint distribution to be. :)

If you want the joint distribution to be normal, you could use the function mvrnorm() from the MASS package.

HTH. Cheers,

        Berwin


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Dec 16 03:10:59 2005

This archive was generated by hypermail 2.1.8 : Fri 16 Dec 2005 - 04:29:53 EST