rndWishart#

Purpose#

Computes Wishart distributed random numbers given a covariance matrix.

Format#

r = rndWishart(numMats, cov, df)#
{ r, newstate } = rndWishart(numMats, cov, df, state)
Parameters:
  • numMats (scalar) – number of Wishart random matrices to create.

  • cov (matrix) – NxM covariance matrix

  • df (scalar) – degrees of freedom.

  • state (scalar or opaque vector) –

    Optional argument.

    scalar case

    state = starting seed value only. If -1, GAUSS computes the starting seed based on the system clock.

    opaque vector case

    state = the state vector returned from a previous call to one of the rnd random number functions.

Returns:
  • r (numMats * rows(cov) x N matrix) – Wishart random matrices.

  • newstate (Opaque vector) – the updated state.

Examples#

// covariance matrix
cov = {  1   0.5,
       0.5     1 };

// degrees of freedom
df = 7;

X = rndWishart(1, cov, df);
X = 7.6019339 4.7744799
    4.7744799 7.7341260

Remarks#

The properties of the pseudo-random numbers in X are:

\[ \begin{align}\begin{aligned}\begin{split}E(X) = df * cov\\\end{split}\\Var(X_{ij}) = df * (cov_{ij}^2 + cov_{ii}*cov_{jj})\end{aligned}\end{align} \]