Re: [R] Defining vectors with per-determined correlations

2014-09-07 Thread peter dalgaard
On 04 Sep 2014, at 19:32 , Ista Zahn wrote: > See ?mvrnorm in the MASS package. ... and in particular, notice its empirical=TRUE argument. Also, notice that the 3rd correlation (corr(x, z)=r3, say) can't be set arbitrarily: if r1=r2=0.99, r3 cannot be zero. > > Best, > Ista > > > On Thu

Re: [R] Defining vectors with per-determined correlations

2014-09-04 Thread Ista Zahn
See ?mvrnorm in the MASS package. Best, Ista On Thu, Sep 4, 2014 at 12:04 PM, John Sorkin wrote: > I need to define three vectors x, y, z (each of length 100) such that the > pair-wise correlations of the vectors have per-defined values r1 and r2. > More specifically I need to define x, y, and

[R] Defining vectors with per-determined correlations

2014-09-04 Thread John Sorkin
I need to define three vectors x, y, z (each of length 100) such that the pair-wise correlations of the vectors have per-defined values r1 and r2. More specifically I need to define x, y, and z so that: corr(x,y) = r1 corr(y,z) = r2 Is there any easy way to accomplish this with R? Thank you