50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

CholWishart (version 1.1.4)

rInvWishart: Random Inverse Wishart Distributed Matrices

Description

Generate n random matrices, distributed according to the inverse Wishart distribution with parameters Sigma and df, Wp(Sigma,df).

Note there are different ways of parameterizing the Inverse Wishart distribution, so check which one you need. Here, if XIWp(Σ,ν) then X1Wp(Σ1,ν). Dawid (1981) has a different definition: if XWp(Σ1,ν) and ν>p1, then X1=YIW(Σ,δ), where δ=νp+1.

Usage

rInvWishart(n, df, Sigma)

Value

a numeric array, say R, of dimension p×p×n, where each R[,,i] is a realization of the inverse Wishart distribution IWp(Sigma,df). Based on a modification of the existing code for the rWishart

function.

Arguments

n

integer sample size.

df

numeric parameter, "degrees of freedom".

Sigma

positive definite p×p "scale" matrix, the matrix parameter of the distribution.

References

Dawid, A. (1981). Some Matrix-Variate Distribution Theory: Notational Considerations and a Bayesian Application. Biometrika, 68(1), 265-274. tools:::Rd_expr_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, rCholWishart, and rInvCholWishart

Examples

Run this code
set.seed(20180221)
A <- rInvWishart(1L, 10, 5 * diag(5L))[, , 1]
set.seed(20180221)
B <- stats::rWishart(1L, 10, .2 * diag(5L))[, , 1]

A %*% B

Run the code above in your browser using DataLab