dist.Wishart.Cholesky {LaplacesDemon}R Documentation

Wishart Distribution: Cholesky Parameterization

Description

These functions provide the density and random number generation for the Wishart distribution with the Cholesky parameterization.

Usage

   dwishartc(U, nu, S, log=FALSE)
   rwishartc(nu, S)

Arguments

U

This is the upper-triangular k \times k matrix for the Cholesky factor \textbf{U} of precision matrix \Omega.

nu

This is the scalar degrees of freedom \nu.

S

This is the symmetric, positive-semidefinite, k \times k scale matrix \textbf{S}.

log

Logical. If log=TRUE, then the logarithm of the density is returned.

Details

The Wishart distribution is a generalization to multiple dimensions of the chi-square distribution, or, in the case of non-integer degrees of freedom, of the gamma distribution. However, the Wishart distribution is not called the multivariate chi-squared distribution because the marginal distribution of the off-diagonal elements is not chi-squared.

The Wishart is the conjugate prior distribution for the precision matrix \Omega, the inverse of which (covariance matrix \Sigma) is used in a multivariate normal distribution. In this parameterization, \Omega has been decomposed to the upper-triangular Cholesky factor \textbf{U}, as per chol.

The integral is finite when \nu \ge k, where \nu is the scalar degrees of freedom parameter, and k is the dimension of scale matrix \textbf{S}. The density is finite when \nu ge k + 1, which is recommended.

The degrees of freedom, \nu, is equivalent to specifying a prior sample size, indicating the confidence in \textbf{S}, where \textbf{S} is a prior guess at the order of covariance matrix \Sigma. A flat prior distribution is obtained as \nu \rightarrow 0.

In practice, \textbf{U} is fully unconstrained for proposals when its diagonal is log-transformed. The diagonal is exponentiated after a proposal and before other calculations. Overall, the Cholesky parameterization is faster than the traditional parameterization. Compared with dwishart, dwishartc must additionally matrix-multiply the Cholesky back to the precision matrix, but it does not have to check for or correct the precision matrix to positive-semidefiniteness, which overall is slower. Compared with rwishart, rwishartc must additionally calculate a Cholesky decomposition, and is therefore slower.

The Wishart prior lacks flexibility, having only one parameter, \nu, to control the variability for all k(k + 1)/2 elements. Popular choices for the scale matrix \textbf{S} include an identity matrix or sample covariance matrix. When the model sample size is small, the specification of the scale matrix can be influential.

Although the related inverse Wishart distribution has a dependency between variance and correlation, the Wishart distribution does not have this dependency.

The matrix gamma (dmatrixgamma) distribution is a more general version of the Wishart distribution, and the Yang-Berger (dyangberger) distribution is an alterative that is a least informative prior (LIP).

Value

dwishartc gives the density and rwishartc generates random deviates.

References

Wishart, J. (1928). "The Generalised Product Moment Distribution in Samples from a Normal Multivariate Population". Biometrika, 20A(1-2), p. 32–52.

See Also

chol, dchisq, dgamma, dinvwishart, dinvwishartc, dmatrixgamma, dmvnp, dmvnpc, Prec2Cov, and dyangbergerc.

Examples

library(LaplacesDemon)
Omega <- matrix(c(2,-.3,-.3,4),2,2)
U <- chol(Omega)
x <- dwishartc(U, 3, matrix(c(1,.1,.1,1),2,2))
x <- rwishartc(3, matrix(c(1,.1,.1,1),2,2))

[Package LaplacesDemon version 16.1.6 Index]