# rwishart: Wishart and inverse-Wishart distributions In AEBilgrau/correlateR: Fast correlations and covariances

## Description

Generate data from Wishart and inverse-Wishart distributions using the Barlett decomposition. When simulating from the Wishart distribution and `nu` is an integer strictly less than p, then the functions draws from a singular Wishart distribution using multivariate normal draws.

## Usage

 ```1 2 3``` ```rwishart(n, sigma = diag(3), nu = 10, verbose = TRUE) rinvwishart(n, psi = diag(3), nu = 10) ```

## Arguments

 `n` The number of realizations. `sigma` A `p` by `p` symmetric positive definite matrix. `nu` An numeric of length one giving the degrees of freedom. `verbose` logical. Warn if draws are from a singular Wishart distribution. `psi` A square symmetric positive definite matrix.

## Value

`rwishart` returns an `p` by `p` by `n` 3-dimensional array where each slice is a draw from the Wishart distribution.

For `rinvwishart` each slice is a draw from the inverse Wishart distribution.

`rWishart` from the stats-package.
 ```1 2 3 4 5 6 7``` ```rwishart(n = 2) rwishart(n = 3, diag(4), nu = 4) rwishart(n = 1, diag(3), nu = 3) rwishart(n = 1, diag(3), nu = 2) rwishart(n = 1, diag(3), nu = 1) rinvwishart(n = 2) ```