# rinvwishart: Inverse-Wishart sampler In matrixsampling: Simulations of Matrix Variate Distributions

## Description

Samples the inverse-Wishart distribution.

## Usage

 `1` ```rinvwishart(n, nu, Omega, epsilon = 0, checkSymmetry = TRUE) ```

## Arguments

 `n` sample size, a positive integer `nu` degrees of freedom, must satisfy `nu > p-1`, where `p` is the dimension (the order of `Omega`) `Omega` scale matrix, a positive definite real matrix `epsilon` threshold to force invertibility in the algorithm; see Details `checkSymmetry` logical, whether to check the symmetry of `Omega`; if `FALSE`, only the upper triangular part of `Omega` is used

## Details

The inverse-Wishart distribution with scale matrix Ω is defined as the inverse of the Wishart distribution with scale matrix Ω-1 and same number of degrees of freedom. The argument `epsilon` is a threshold whose role is to guarantee the invertibility of the sampled Wishart distributions. See Details in `rwishart`.

## Value

A numeric three-dimensional array; simulations are stacked along the third dimension (see example).

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```nu <- 6 p <- 3 Omega <- toeplitz(p:1) IWsims <- rinvwishart(10000, nu, Omega) dim(IWsims) # 3 3 10000 apply(IWsims, 1:2, mean) # approximately Omega/(nu-p-1) # the epsilon argument: IWsims <- tryCatch(rinvwishart(10000, nu=p+0.001, Omega), error=function(e) e) IWsims <- tryCatch(rinvwishart(10000, nu=p+0.001, Omega, epsilon=1e-8), error=function(e) e) ```

matrixsampling documentation built on Aug. 25, 2019, 1:03 a.m.