Learn R Programming

dlm (version 0.7-1)

rwishart: Random Whishart matrix

Description

Generate a draw from a Wishart distribution.

Usage

rwishart(df, p = nrow(SqrtSigma), SqrtSigma = diag(p))

Arguments

df
Degrees of freedom. It has to be integer.
p
Dimension of the matrix to simulate.
SqrtSigma
A "square root" of the matrix parameter Sigma of the Wishart distribution. Sigma must be equal to crossprod(SqrtSigma).

Value

  • The function returns one draw from the Wishart distribution with df degrees of freedom and matrix parameter crossprod(SqrtSigma)

Warning

The function only works for an integer number of degrees of freedom.

References

Mardia, Kent and Bibby (1979). Multivariate analysis.

Examples

Run this code
rwishart(25, p = 2)

Run the code above in your browser using DataLab