[R] Creating a correlation matrix from a vector

F_Smithers calex1991 at googlemail.com
Fri Oct 26 15:52:41 CEST 2012


I'm looking to create a correlation matrix, but I have already obtained the
correlations, which are stored in a vector. (Basically, I'm running a
simulation which requires a correlation matrix, but I am simulating the
various correlations.)

My aim is to create a function that can take the vector, and fit the values
into their respective locations in a correlation matrix. (The correlations
are ordered as if working along the upper triangle of the correlation matrix
row-wise.)

The initial step in the function was to create a diagonal matrix of length
n, (n being the number of factors) and then add the correlations at each
level using a for command.

Thanks



--
View this message in context: http://r.789695.n4.nabble.com/Creating-a-correlation-matrix-from-a-vector-tp4647548.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list