rui
2003-Jul-13 01:42 UTC
[R] How to generate a matrix with a specific correlation (matrix)
Dear R community: How to generate a matrix with a specific correlation (matrix)? Thanks in advance. Rui [[alternative HTML version deleted]]
Spencer Graves
2003-Jul-13 02:39 UTC
[R] How to generate a matrix with a specific correlation (matrix)
If var(X) = diag(n) = n x n identity matrix, then var(A%*%X) = A %*% t(A). If you can generate vector(s) X of uncorrelated observations with whatever distribution you want, then let A = t(chol(Correl)), where Correl = the desired correlation matrix. If you want multivariate normal or t distributions, the package mvtnorm downloadable from CRAN will do this for you. If this does not solve your problem, I suggest you provide a toy example that explains very succinctly what you want, what you've tried, and the deficiencies in what you've tried. hope this helps. spencer graves rui wrote:> Dear R community: > > How to generate a matrix with a specific correlation (matrix)? > Thanks in advance. > > Rui > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help