pub fn random_correlation_matrix<R: Rng + ?Sized>(
dimension: usize,
rng: &mut R,
) -> Result<DMatrix<f64>>Expand description
Generate a random correlation matrix.
Uses the method of Joe (2006) to generate a random correlation matrix that is guaranteed to be positive definite.
§Arguments
dimension- Size of the correlation matrixrng- Random number generator
§Returns
A random positive definite correlation matrix.
§Examples
use copula_core::utils::random_correlation_matrix;
let mut rng = rand::rng();
let corr = random_correlation_matrix(3, &mut rng)?;
assert_eq!(corr.shape(), (3, 3));