rInvCholWishart {CholWishart} | R Documentation |
Cholesky Factor of Random Inverse Wishart Distributed Matrices
Description
Generate n random matrices, distributed according
to the Cholesky factor of an inverse Wishart distribution with
parameters Sigma
and df
, W_p(Sigma, df)
.
Note there are different ways of parameterizing the Inverse
Wishart distribution, so check which one you need.
Here, if X \sim IW_p(\Sigma, \nu)
then
X^{-1} \sim W_p(\Sigma^{-1}, \nu)
.
Dawid (1981) has a different definition: if
X \sim W_p(\Sigma^{-1}, \nu)
and
\nu > p - 1
, then
X^{-1} = Y \sim IW(\Sigma, \delta)
,
where \delta = \nu - p + 1
.
Usage
rInvCholWishart(n, df, Sigma)
Arguments
n |
integer sample size. |
df |
numeric parameter, "degrees of freedom". |
Sigma |
positive definite |
Value
a numeric array, say R
, of dimension
p \times p \times n
,
where each R[,,i]
is a Cholesky decomposition of a realization
of the Wishart distribution W_p(Sigma, df)
.
Based on a modification of the existing code for the rWishart
function
References
Anderson, T. W. (2003). An Introduction to Multivariate Statistical Analysis (3rd ed.). Hoboken, N. J.: Wiley Interscience.
Dawid, A. (1981). Some Matrix-Variate Distribution Theory: Notational Considerations and a Bayesian Application. Biometrika, 68(1), 265-274. doi: 10.2307/2335827
Gupta, A. K. and D. K. Nagar (1999). Matrix variate distributions. Chapman and Hall.
Mardia, K. V., J. T. Kent, and J. M. Bibby (1979) Multivariate Analysis, London: Academic Press.
See Also
rWishart
and rCholWishart
Examples
# How it is parameterized:
set.seed(20180211)
A <- rCholWishart(1L, 10, 3 * diag(5L))[, , 1]
A
set.seed(20180211)
B <- rInvCholWishart(1L, 10, 1 / 3 * diag(5L))[, , 1]
B
crossprod(A) %*% crossprod(B)
set.seed(20180211)
C <- chol(stats::rWishart(1L, 10, 3 * diag(5L))[, , 1])
C