rwishart function

Draw from Wishart distribution

Draw from Wishart distribution

This function draws from a Wishart and inverted Wishart distribution.

rwishart(nu, V)

Arguments

  • nu: A numeric, the degrees of freedom. Must be at least the number of dimensions.
  • V: A matrix, the scale matrix.

Returns

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