wishart_matrix


wishart_matrix, a C code which produces sample matrices from the Wishart or Bartlett distributions, useful for sampling random covariance matrices.

The Wishart distribution is a probability distribution for random nonnegative-definite NxN matrices that can be used to select random covariance matrices.

The objects of the distribution are NxN matrices which are the sum of DF rank-one matrices X*X' constructed from N-vectors X, where the vectors X have zero mean and covariance SIGMA. This implies that the expected value of a Wishart matrix is DF * SIGMA.

A simplified version of the Wishart distribution assumes that SIGMA is the identity matrix. We will call this the "unit Wishart distribution".

Because any Wishart matrix W is symmetric nonnegative definite, there is an upper triangular factor T so that W = T' * T. There is a corresponding Bartlett distribution of the matrices T, so that one can alternatively sample the Bartlett distribution by sampling the Bartlett distribution for T, and then forming W.

In order to generate the necessary random values, the library relies on the pdflib() and rnglib() libraries.

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

wishart_matrix is available in a C version and a C++ version and a Fortran77 version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

wishart_matrix_test

asa053, a C code which produces sample matrices from the Wishart distribution, by William Smith and Ronald Hocking. This is a version of Applied Statistics Algorithm 53.

pdflib, a C code which evaluates Probability Density Functions (PDF's) and produces random samples from them, including beta, binomial, chi, exponential, gamma, inverse chi, inverse gamma, multinomial, normal, scaled inverse chi, and uniform.

ranlib, a C code which produces random samples from Probability Density Functions (PDF's), including Beta, Chi-square Exponential, F, Gamma, Multivariate normal, Noncentral chi-square, Noncentral F, Univariate normal, random permutations, Real uniform, Binomial, Negative Binomial, Multinomial, Poisson and Integer uniform, by Barry Brown and James Lovato.

rnglib, a C code which implements a random number generator (RNG) with splitting facilities, allowing multiple independent streams to be computed, by L'Ecuyer and Cote.

Reference:

Source Code:


Last revised on 30 September 2022.