powered by
Generate the marginal density of a correlation from a uniformly sampled R matrix.
corDensity(NVar)
corDensity returns the following objects:
corDensity
r (numeric) A sequence of numbers from -1, to 1 in .001 increments.
rDensity (numeric) The density of r.
r
(integer) The order of the correlation matrix.
Niels G. Waller
Hürlimann, W. (2012). Positive semi-definite correlation matrices: Recursive algorithmic generation and volume measure. Pure Mathematical Science, 1(3), 137--149.
Joe, H. (2006). Generating random correlation matrices based on partial correlations. Journal of Multivariate Analysis, 97(10), 2177--2189.
out <- corDensity(NVar = 5) plot(out$r, out$rDensity, typ = "l", xlab = "r", ylab = "Density of r", main = "")
Run the code above in your browser using DataLab