Re: [R] Generating artificial datasets with a specific correlation coefficient.

From: John Vokey <>
Date: Wed, 13 Jun 2007 21:14:42 -0600


   Try here: < Generating_Correlated_Random_Numbers>; the example code is in matlab, but it is trivial to translate to R. Note, if you use principal components as the source vectors (thanks to Jason Tangen for the suggestion), the correlations between the resulting vectors will be exactly the specified r-values.

On 13-Jun-07, at 4:00 AM, wrote:
> I need to create artificial datasets with specific correlation
> coefficients (i.e. a dataset that returns r = 0.30, etc.) as examples
> for a lab I am teaching this summer. Is there a way to do that in R?

Please avoid sending me Word or PowerPoint attachments.
See <>

-Dr. John R. Vokey

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 14 Jun 2007 - 03:22:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Jun 2007 - 05:31:57 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.