Learn R Programming

oeli (version 0.7.1)

sample_correlation_matrix: 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))

Value

A correlation matrix.

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.

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

Run this code
sample_correlation_matrix(dim = 3)

Run the code above in your browser using DataLab