This function draws from a Wishart and inverted Wishart distribution.
Value
A list, the draws from the Wishart (W
), inverted Wishart (IW
), and
corresponding Choleski decomposition (C
and CI
).
Details
The Wishart distribution is a generalization to multiple dimensions of the
gamma distributions and draws from the space of covariance matrices.
Its expectation is nu*V
and its variance increases both in nu
and in the values of V
.
The Wishart distribution is the conjugate prior to the precision matrix of
a multivariate normal distribution and proper if nu
is greater than
the number of dimensions.
Examples
rwishart(nu = 2, V = diag(2))
#> $W
#> [,1] [,2]
#> [1,] 1.277530 -2.393022
#> [2,] -2.393022 4.494557
#>
#> $IW
#> [,1] [,2]
#> [1,] 292.2886 155.62223
#> [2,] 155.6222 83.07991
#>
#> $C
#> [,1] [,2]
#> [1,] 1.130279 -2.1171964
#> [2,] 0.000000 0.1097115
#>
#> $CI
#> [,1] [,2]
#> [1,] 0.8847376 17.073542
#> [2,] 0.0000000 9.114818
#>