wishart {Boom} | R Documentation |
Wishart Distribution
Description
Density and random generation for the Wishart distribution.
Usage
dWishart(W, Sigma, nu, logscale = FALSE)
rWishart(nu, scale.matrix, inverse = FALSE)
Arguments
W |
Argument (random variable) for the Wishart density. A symmetric positive definite matrix. |
Sigma |
Scale or "variance" parameter of the Wishart distribution. See the "details" section below. |
nu |
The "degrees of freedom" parameter of the Wishart
distribution. The distribution is only defined for |
logscale |
Logical. If |
scale.matrix |
For the Wishart distribution the
If simulating from the inverse Wishart, |
inverse |
Logical. If TRUE then simulate from the inverse Wishart distribution. If FALSE then simulate from the Wishart distribution. |
Details
If nu
is an integer then a W(\Sigma, \nu)
random variable can be thought of as the sum of nu
outer
products: y_iy_i^T
, where y_i
is a zero-mean
multivariate normal with variance matrix Sigma
.
The Wishart distribution is
\frac{|W|^{\frac{\nu - p - 1}{2}} \exp(-tr(\Sigma^{-1}W) / 2)}{
2^{\frac{\nu p}{2}}|\Sigma|^{\frac{\nu}{2}}\Gamma_p(\nu / 2)}%
where p == nrow(W)
and \Gamma_p(\nu)
is the
multivariate gamma function (see lmgamma
).
Value
dWishart
returns the density of the Wishart distribution. It
is not vectorized, so only one random variable (matrix) can be
evaluated at a time.
rWishart
returns one or more draws from the Wishart or inverse
Wishart distributions. If n > 0
the result is a 3-way array.
Unlike the rWishart
function from the stats
package, the first index corresponds to draws. This is in keeping
with the convention of other models from the Boom package.
Author(s)
Steven L. Scott steve.the.bayesian@gmail.com