# rNonsingularWishart: Random Nonsingular Wishart Matrix In rWishart: Random Wishart Matrix Generation

## Description

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

## Usage

 ```1 2``` ```rNonsingularWishart(n, df, Sigma, covariance = FALSE, simplify = "array") ```

## Arguments

 `n` integer: the number of replications. `df` numeric parameter, “degrees of freedom”. `Sigma` positive definite (p * p) “scale” matrix, the matrix parameter of the distribution. `covariance` logical on whether a covariance matrix should be generated `simplify` logical or character string; should the result be simplified to a vector, matrix or higher dimensional array if possible? For `sapply` it must be named and not abbreviated. The default value, `TRUE`, returns a vector or matrix if appropriate, whereas if `simplify = "array"` the result may be an `array` of “rank” (=`length(dim(.))`) one higher than the result of `FUN(X[[i]])`.

## Details

If X_1, ..., X_m is a sample of m independent multivariate Gaussians with mean vector 0, and covariance matrix Sigma, the distribution of M = X'X is W_p(Sigma, m).

## Value

A numeric array of dimension `p * p * n`, where each array is a positive semidefinite matrix, a realization of the Wishart distribution W_p(Sigma, df)

## Examples

 `1` ```rNonsingularWishart(2, 20, diag(1, 5)) ```

### Example output

```Attaching package: ‘rWishart’

The following object is masked from ‘package:stats’:

rWishart

, , 1

[,1]      [,2]      [,3]      [,4]      [,5]
[1,] 27.570534  7.884664  8.059230  6.589777 -4.581074
[2,]  7.884664 17.299404  2.899076 -3.231619  1.760020
[3,]  8.059230  2.899076 21.751498 -5.333127  4.665002
[4,]  6.589777 -3.231619 -5.333127 16.180899 -7.651389
[5,] -4.581074  1.760020  4.665002 -7.651389 16.212315

, , 2

[,1]       [,2]      [,3]      [,4]       [,5]
[1,] 11.334864 -4.9732218 -0.986789 -5.046448 -0.1582060
[2,] -4.973222 23.4980530  3.100825  2.157272  0.5676472
[3,] -0.986789  3.1008247 15.902792  8.213986 -1.5938394
[4,] -5.046448  2.1572722  8.213986 30.593981  2.2248252
[5,] -0.158206  0.5676472 -1.593839  2.224825 18.2645161
```

rWishart documentation built on Nov. 20, 2019, 1:07 a.m.