I am trying to fit a multivariate Gaussian with a non-diagonal covariance matrix $\Sigma$ using nested sampling.

Usually, in other Bayesian analyses, we would use a Inverse Wishart or LKJ prior on the covariance matrix and compute the posterior using the analytical form of the prior.

However, in nested sampling, we cannot do this. We must specify the prior in terms of a transform from uniform uncorrelated samples. For instance, for a 1d normal prior, the prior transform would be the percent point function of the normal (the inverse of the CDF). norm.ppf(uniform_samples) gives you samples from the prior.

Unless I am mistaken, there is no function to transform uniform samples into a Wishart or LKJ prior.

Is there a better prior for covariance matrices that has a usable transform? Or is there a technqiue to estimate these transforms? Using a uniform prior on covariance matrix elements seems foolish.



1 Answer 1


Have a look at codes generating random inverse wishart matrices (e.g, Jones 2007).

For example, the scipy implementation (https://github.com/scipy/scipy/blob/v1.6.0/scipy/stats/_multivariate.py#L2754 functions rvs, _rvs and _standard_rvs) use chi² and normal random draws and combines them with linalg.

You can take each normal/chi² variable based on a transform of the unit cube, and then follow the same procedure to obtain the matrix.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.