Create correlation matrix
I need to create a correlation matrix to use for some simulations. I want all the off-diagonal elements of the correlation to be the same value. Here is a simple script that does that, but I was wondering if there was a simpler way to do it.
names default to here(1);
// create correlation matrix with specified correlation
k=5;
r=0.9;
corr_matrix=J(k,k,r);
// diagonal elements equal to 1 by
...