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.2329947 -0.1942156 -0.1607765
#> [2,] -0.1942156  2.6335816 -0.1853609
#> [3,] -0.1607765 -0.1853609  1.0293419