# Can I use the Cholesky-method for generating correlated random variables with given mean?

I want to generate correlated random variables with a given correlation matrix, means, and variances. Does the Cholesky decomposition only work when the initial random variables are iids with the same mean and variance?

• If you generate correlated random variables with each having mean zero, then add a constant to each individual variable, what is the outcome? – John Mar 12 '14 at 19:39
• Okay, but how do I manipulate the variance? – kanbhold Mar 12 '14 at 19:52
• Same concept. If you generate correlated random variables with mean 0 and standard deviation 1, then multiply each univariate series by their respective standard deviations, then what is the outcome? Of course, if you have the correlations and variances, you can save yourself the trouble by just using the covariance matrix. – John Mar 12 '14 at 20:09
• @John I thought this was a duplicate but I can't seem to locate one, so you might want to consider making your comments into an answer (though you may want to try your own search first). – Glen_b Mar 12 '14 at 22:08
• kanbhold: This answer deals with a more general case. There's also some good information in the top two answers here, but you'd have to combine them to get what you're asking. Neither is quite a duplicate, so you may get some more direct answers along the lines of John's suggestion. – Glen_b Mar 12 '14 at 22:10

Let Z be uncorrelated random variables normally distributed with mean 0 and variance 1. This means $$Z\sim N\left(0,I\right)$$ If you make an affine transformation $$X\equiv A+BZ$$ then $X$ has a distribution $$X\sim N\left(A,BB'\right)$$ In our case, we want $BB'=\Sigma$, so applying the cholesky decomposition to $\Sigma$ is one way to find a suitable $B$. Thus, to simulate from $X\sim N\left(\mu,\Sigma\right)$, you would simulate $Z$, set $A=\mu$ and $B=chol(\Sigma)$, and apply the transformation above.

So to answer your question, uncorrelated variables of mean 0 and variance 1 can be transformed to generic multivariate normal distributions through the use of affine transformations, depending on the mean vector and cholesky decomposition of the covariance matrix. This is how multivariate normal random number generators generally work.

To address your other point in the comments, suppose you simulate $Z$ and make a transformation $$Y\equiv chol(C)Z$$ so that $Y\sim N(0, C)$. You can still get to $X$ from $Y$. As I discussed in the comments, you can easily do this by multiplying the univariate distributions by the respective standard deviations and adding the respective mean.

More formally, you can consider this another affine transformation $$X\equiv A+SY$$ However, since $Y$ is not uncorrelated, the affine transformation would give $$X\sim N\left(A,SCS'\right)$$ In this case, to get $SCS'=\Sigma$, you would need to set $S$ equal to a matrix with the standard deviations on the diagonal and zeros elsewhere. This is equivalent to applying the transformations on a univariate basis.