Article Menu |
Generating Correlated Random Numbersby M.A. (Thijs) van den Berg This article describes common methods that are used in generating correlated random numbers.
[edit] Generating two sequences of correlated random numbersGenerating two sequences of random numbers with a given correlation is done in two simple steps:
This new [edit] Before and after correlating[edit] Generating multiple (more than two) sequences of correlated random variablesA general way to generate correlated (normal distributed) random numbers -with a given correlation matrix Using this matrix, one can generate correlated random numbers There are multiple way to find such a matrix. The two most common methods are
[edit] Example using a Cholesky decompositionWe want to generate random numbers for three variables with the following correlations matrix:
Doing a Cholesky decomposition on the correlation matrix give the following matrix:
Depending on the algorithm used for the Cholesky decomposition, you can also get the transposed of this matrix. This does doesn't matter. We can now transform three uncorrelated random numbers
into correlated numbers Rc by multiplying them with the U matrix.
[edit] Example using a Eigenvector decompositionThe correlation matrix and eigenvalues
If we define we get a matrix which gives us the final result for the decomposition
We can now transform three uncorrelated random numbers into correlated numbers Rc by multiplying them with the U matrix.
[edit] Example Matlab codeThe matlab code below decomposes the correlation matrix C into an upper matrix U using a Cholesky decomposition. Next 10 vectors with 3 random normal numbers are multiplied with the upper matrix to generate 10 correlated draws.
|
sequence will have a correlation of
with the
sequence.


- is done by finding a matrix U such that
from uncorrelated numbers
by multiplying them with this matrix.
that has the property