randomgen.generator.ExtendedGenerator.wishart

ExtendedGenerator.wishart(df, scale, size=None, *, check_valid='warn', tol=None, rank=None, method='svd')

Draw samples from the Wishart and pseudo-Wishart distributions.

Parameters:
df

Degree-of-freedom values. In array-like must broadcast with all but the final two dimensions of shape.

scale

Shape matrix of the distribution. It must be symmetric and positive-semidefinite for sampling. Must have shape (c1, c2, …, cj, N, N) where (c1, c2, …, cj) broadcasts with the degree of freedom shape (d1, d2, …, dk).

size=None

Given a shape of, for example, (m,n,k), m*n*k samples are generated, and packed in an m-by-n-by-k arrangement. Because each sample is N by N, the output shape is (m,n,k,N,N). If no shape is specified, a single (N by N) sample is returned.

check_valid='warn'

Behavior when the covariance matrix has rank less than rank.

tol=None

Tolerance when checking the rank of shape. shape is cast to double before the check. If None, then the tolerance is automatically determined as a function of N and the limit of floating point precision.

rank=None

The rank of shape when generating from the Singular Wishart distribution. If None, then rank is set of N so that the draws from the standard Wishart or pseudo-Wishart are generated.

method='svd'

The cov input is used to compute a factor matrix A such that A @ A.T = cov. This argument is used to select the method used to compute the factor matrix A. The default method ‘svd’ is the slowest, while ‘cholesky’ is the fastest but less robust than the slowest method. The method eigh uses eigen decomposition to compute A and is faster than svd but slower than cholesky. When rank is less than N, then the N largest eigenvalues and their associated eigenvalues are used when method is svd or eigh. When method is ‘cholesky, then the Cholesky of the upper rank by rank block is used. factor assumes that scale has been pre-factored so that no transformation is applied. When using factor, no check is performed on the rank.

Returns:

The generated variates from the Wishart distribution.

Return type:

numpy.ndarray

See also

standard_wishart

Generate variates with an identify scale.

Notes

Uses the method of Odell and Feiveson [1] when df >= dim. Otherwise variates are directly generated as the inner product of df by dim arrays of standard normal random variates.

References