Jim, Try here: <http://www.sitmo.com/doc/ 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, [EMAIL PROTECTED] 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 <http://www.gnu.org/philosophy/no-word-attachments.html> -Dr. John R. Vokey ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
