[R] How to generate a matrix with a specific correlation (matrix)

Spencer Graves spencer.graves at pdf.com
Sun Jul 13 04:39:41 CEST 2003


	  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




More information about the R-help mailing list