rcorr function

Random correlation matrix

Random correlation matrix

Generates a random correlation matrix with the method of Marsaglia and Olkin (1984).

rcorr(d)

Arguments

  • d: an integer > 0, the order of the correlation matrix.

Details

The algorithm uses rsphere to generate dd

vectors on a sphere in dd-space. If ZZ

is a matrix with such vectors as rows, then the random correlation matrix is ZZZZ'.

Returns

a correlation matrix of order d.

References

Marshall, G.& Olkin, I. (1984).Generating correlation matrices. SIAM J. Sci. Stat. Comput., 5, 2, 470--475.

Author(s)

Giovanni M. Marchetti

See Also

rsphere

Examples

## A random correlation matrix of order 3 rcorr(3) ## A random correlation matrix of order 5 rcorr(5)