Same code as rWishart function in package stats.

rwish(v, S, is_chol = FALSE, return_chol = FALSE)

Arguments

v

dof

S

the scale matrix (pxp)

is_chol

if TRUE, S is the upper Cholesky factor of S

return_chol

if TRUE, the upper Cholesky factor is returned

Value

a single random variate from W(v, S)

Wishart parametrization

Uses (Press 2012; Anderson 2003) parametrization.

$$X \sim W(\nu, S)$$ with \(S\) is a \(p \times p\) matrix, \(\nu >= p\) (the degrees of freedom).

Then: $$E[X] = \nu S$$

References

Anderson TW (2003). An Introduction to Multivariate Statistical Analysis, Wiley Series in Probability and Statistics, 3rd ed edition. Wiley-Interscience, Hoboken, N.J. ISBN 978-0-471-36091-9.

Press SJ (2012). Applied Multivariate Analysis: Using Bayesian and Frequentist Methods of Inference. Courier Corporation.

See also