Let's assume I want to generate k samples of n random numbers, that are correlated according to a given correlation matrix C (e.g. $n = 3$):
1 0.3 0.3 0.3 1 0.3 0.3 0.3 1
Using Cholesky Decomposition (Python implementation from NumPy), I can calculate L so $C = LL^T$:
L = [[ 1. 0. 0. ] [ 0.3 0.9539392 0. ] [ 0.3 0.22013982 0.92819096]]
Generating n (uncorrelated) random numbers (using numpy.random.normal($\mu$, $\sigma$)) and multiplying each the vector with L should result in one sample with n correlated random variables. – So far my understanding of the algorithm.
When I check the random numbers with SPSS, the "observed" correlations differ from the ones given in C. Example: I choose $n = 3$, $k = 10 000$ and $r = 0.99$. The observed correlations are:
V1 V2 V3 V1 1 .774 .578 V2 .774 1 .443 V3 .578 .443 1
For my use-case I will need random numbers, that represent the given correlation matrix precisely. Did I make a mistake in this process or did I misunderstand the algorithm? Some insight is much appreciated.