Skip to contents

This function samples a covariance matrix from an inverse Wishart distribution.

Usage

sample_covariance_matrix(dim, df = dim, scale = diag(dim), diag = FALSE)

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.

diag

[logical(1)]
Diagonal matrix?

Value

A covariance matrix.

Examples

sample_covariance_matrix(dim = 3)
#>            [,1]       [,2]      [,3]
#> [1,]  0.8534587 -0.3153559 -2.335426
#> [2,] -0.3153559  0.4821055  1.325216
#> [3,] -2.3354262  1.3252162  9.285926