rwishart(df, p = nrow(SqrtSigma), Sigma, SqrtSigma = diag(p))
Arguments
df: degrees of freedom. It has to be integer.
p: dimension of the matrix to simulate.
Sigma: the matrix parameter Sigma of the Wishart distribution.
SqrtSigma: a square root of the matrix parameter Sigma of the Wishart distribution. Sigma must be equal to crossprod(SqrtSigma).
Details
The Wishart is a distribution on the set of nonnegative definite symmetric matrices. Its density is
p(W)=∣Σ∣n/2c∣W∣(n−p−1)/2exp{−21tr(Σ−1W)}
where n is the degrees of freedom parameter df and c is a normalizing constant. The mean of the Wishart distribution is nSigma and the variance of an entry is
Var(Wij)=n(Σij2+ΣiiΣjj)
The matrix parameter, which should be a positive definite symmetric matrix, can be specified via either the argument Sigma or SqrtSigma. If Sigma is specified, then SqrtSigma is ignored. No checks are made for symmetry and positive definiteness of Sigma.
Returns
The function returns one draw from the Wishart distribution with df degrees of freedom and matrix parameter Sigma or crossprod(SqrtSigma)