[R] Generate data from correlation matrix

Ista Zahn izahn at psych.rochester.edu
Tue Feb 8 05:15:52 CET 2011


Hi Jeremy,
See the mvrnorm function in the MASS package.

-Ish

On Tue, Feb 8, 2011 at 4:10 AM, Jeremy Miles <jeremy.miles at gmail.com> wrote:
> Hi All,
>
> I was wondering if anyone knew of a function which would generate data
> from a pre-specified correlation matrix (as in the Stata command
> r2corr) or sampled from a population with a specific
> covariance/correlation.  (I thought I'd check before I wrote something
> inelegant and slow.)
>
> Jeremy
>
> --
> Jeremy Miles
> Psychology Research Methods Wiki: www.researchmethodsinpsychology.com
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list