|Description:||generates correlated pseudo random normal variates using the Cholesky factorization.|
|Usage:||x = normalcorr(n,C)|
|n||scalar, time, n represents the number of observations to be generated in each series|
|C||p x q matrix, correlation matrix, e.g. obtained with corr()|
|x||( n, sqrt(size(C)) )-dimensional array, containing the simulated trajectories|
library("multi") library("times") randomize(100) C = reshape(#(1,0.5,0.5,1),#(2,2)) x = normalcorr(200,C) ; simulation of correlated normal variates corr(x)
Contents of r [1,] 1 0.52418 [2,] 0.52418 1 Note: The output vectors (x) approximately have a correlation structure defined by C.