Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rcorr

Random correlation matrix


Description

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

Usage

rcorr(d)

Arguments

d

an integer > 0, the order of the correlation matrix.

Details

The algorithm uses rsphere to generate d vectors on a sphere in d-space. If Z is a matrix with such vectors as rows, then the random correlation matrix is ZZ'.

Value

a correlation matrix of order d.

Author(s)

Giovanni M. Marchetti

References

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

See Also

Examples

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

ggm

Graphical Markov Models with Mixed Graphs

v2.5
GPL-2
Authors
Giovanni M. Marchetti, Mathias Drton, Kayvan Sadeghi
Initial release
2020-02-014

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.