clear
matrix C = (1, 0, 0\0, 1, 0\0, 0, 1)
corr2data x1 x2 x3, n(100) corr(C) clear
//Impose correlations:
//corr(x1,x2)=.25
//corr(x1,x3)=.33
//corr(x2,x3)=.75
mata
P =(1, .25, .33\.25, 1 , .75 \ .33, .75 , 1)
A = cholesky(P)
X= st_data( ., .)
R = X*A'
corr = correlation(R,1)
st_matrix ("corr", corr)
st_matrix ("R", R)
end
svmat R
corr R*
Scott
On 8/15/07, Rachel <[email protected]> wrote:
> Hi Mike,
>
> The issue with drawnorm is that it draws all the variables at once. I
> need to draw a set of variables with a fixed correlation structure
> relative to an EXISTING variable.
>
> Thanks,
> Rachel
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/