Description Usage Arguments Details Value Warning Note Author(s) References Examples

Generate a draw from a Wishart distribution.

1 |

`df` |
degrees of freedom. It has to be integer. |

`p` |
dimension of the matrix to simulate. |

`Sigma` |
the matrix parameter Sigma of the Wishart distribution. |

`SqrtSigma` |
a |

The Wishart is a distribution on the set of nonnegative definite symmetric matrices. Its density is

*
p(W) = c|W|^((n-p-1)/2) / |Sigma|^(n/2) exp(-tr(Sigma^(-1)W)/2)*

where *n* is the degrees of freedom parameter `df`

and
*c* is a normalizing constant.
The mean of the Wishart distribution is *n Sigma* and the
variance of an entry is

*
Var(W[i,j]) = n (Sigma[i,j]^2 + Sigma[i,i] Sigma[j,j])*

The matrix parameter, which should be a positive definite symmetric matrix, can be specified via either the argument Sigma or SqrtSigma. If Sigma is specified, then SqrtSigma is ignored. No checks are made for symmetry and positive definiteness of Sigma.

The function returns one draw from the Wishart distribution with
`df`

degrees of freedom and matrix parameter `Sigma`

or
`crossprod(SqrtSigma)`

The function only works for an integer number of degrees of freedom.

From a suggestion by B.Venables, posted on S-news

Giovanni Petris [email protected]

Press (1982). Applied multivariate analysis.

1 2 3 4 5 |

```
[,1] [,2] [,3]
[1,] 33.745942 -1.688330 8.891044
[2,] -1.688330 44.917684 6.552515
[3,] 8.891044 6.552515 26.584689
[,1] [,2] [,3]
[1,] 57.53135 -27.36463 -84.94352
[2,] -27.36463 22.39320 28.50087
[3,] -84.94352 28.50087 161.45867
[,1] [,2] [,3]
[1,] 54.68665 -22.11895 -90.13139
[2,] -22.11895 20.95790 19.39360
[3,] -90.13139 19.39360 188.85810
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.