# Generate correlated random variables from Normal and Gamma distributions

I want to generate a random vector $z$ of dimension $k+m$ with some given correlation matrix $\Sigma$, such that the first $k$ elements of the vector are distributed normally and the last $m$ elements follow the Gamma distribution with some given parameters $a,b$.

Hier is suggested (applied to this case) to generate a normal r.v. Z as $N(0,\Sigma)$ and then solve $G_{[a,b]}(Y_i)=\Phi_{[0,\Sigma]}(Z_i), i\geq m$ and replace the last m elements of Z with Ys, however it's not guaranteed that the vector $(Z_1, ... , Z_k, Y_{k+1}, ..., Y_{k+m})$ will still have the correlation matrix $\Sigma$.

Is there some nice copula out there that does the job or some other approach?

-

In Oracle Crystal Ball (or in a few other Excel based MC simulation add-ins), we can do this without much hassle: define $k$ normal distribution and $m$ gamma distributions. Define (or load) the correlation matrix $\Sigma$ and then generate the random variates. Each trial run would give you one random vector $z$ of dimension $k+m$.

We use normal copula to generate correlated random numbers from risk distributions in Oracle Crystal Ball.

-
can you elaborate on "and then generate the random variates"? Do you generate k normals and m gammas and the put it into a copula? –  Max Li Jan 16 '13 at 15:51
We generate streams of uniforms, put them through a normal copula to rotate according to the correlation value, and then use inverse PDF to go back to the distribution. –  Samik R Jan 17 '13 at 21:51
from these 3 steps, they are correlated with the desired correlation matrix after the 2nd step, but not after the final 3rd step. correct me if I'm wrong –  Max Li Jan 20 '13 at 18:57
We get streams of uniform numbers with the desired correlation after 2nd step, and then using the inverse PDF, we retain the correlation structure after 3rd step. –  Samik R Jan 21 '13 at 19:37