This function draws from a Wishart or Inverse-Wishart distribution.
rwishart_cpp(df, scale, inv = FALSE)
A matrix
, the random draw.
An integer
, the degrees of freedom.
Must be greater or equal p
.
A matrix
, the scale matrix of dimension p
x p
.
Must be a covariance matrix.
A logical
, if TRUE
the density of the Inverse-Wishart
distribution is returned.
By default, inv = FALSE
.
The Wishart distribution is a generalization to multiple dimensions of the
gamma distributions and draws from the space of covariance matrices.
Its expectation is df * scale
, and its variance increases both in
df
and in the values of scale
.
This function performs no input checks. See rwishart
for the version with input checks.