# 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?

Look here for multivariate distribution on the positive quadrant ... quite difficult. http://xianblog.wordpress.com/tag/multivariate-analysis/ I have been thinking about this for weeks and months in the context of credit risk (modelling default intensities jointly) and I think this does not work.

• Assume that this mixture of distribution is given and I can't escape into log-normal and to some extent tolerant towards negative values. Simulating into positive quadrant with given covariance is also interesting, thanks for this! Jan 13, 2013 at 20:22

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? Jan 16, 2013 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. Jan 17, 2013 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 Jan 20, 2013 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. Jan 21, 2013 at 19:37