sample_correlation_matrix: Sample correlation matrix

View source: R/sample_correlation_matrix.R

sample_correlation_matrixR Documentation

Sample correlation matrix

Description

This function samples a correlation matrix by sampling a covariance matrix from an inverse Wishart distribution and transforming it to a correlation matrix.

Usage

sample_correlation_matrix(dim, df = dim, scale = diag(dim))

Arguments

dim

[integer(1)]
The dimension.

df

[integer(1)]
The degrees of freedom of the inverse Wishart distribution greater or equal dim.

scale

[matrix()]
The scale covariance matrix of the inverse Wishart distribution of dimension dim.

Value

A correlation matrix.

See Also

Other matrix helpers: check_correlation_matrix(), check_covariance_matrix(), check_transition_probability_matrix(), cov_to_chol(), diff_cov(), insert_matrix_column(), matrix_diagonal_indices(), matrix_indices(), sample_covariance_matrix(), sample_transition_probability_matrix(), stationary_distribution()

Examples

sample_correlation_matrix(dim = 3)

oeli documentation built on Oct. 16, 2024, 5:08 p.m.