Multivariate Gaussian density from singular covariance

448 Views Asked by At

I have a multi-dimensional (~600dim) sample from which I determine its covariance matrix. The determinate of the covariance is 0. The sample does not show strong correlations when plotting 2 dimensions.

Now I would like to define a equivalent multivariate Gaussian model. However, in the probability, there is the ${|\Sigma|}^{-{1\over2}}$ term, which is undefined for me.

I don't understand -- an uncorrelated Gaussian should still have a proper probability distribution, right?

Can it be that the determinate of the covariance is 0? Maybe it is a numerical problem computing the covariance of so many dimension?

1

There are 1 best solutions below

0
On

It's a numerical issue of computing the determinate of a high-dimensional matrix. I was able to solve it using the code in https://www.mathworks.de/matlabcentral/fileexchange/22026-safe-computation-of-logarithm-determinat-of-large-matrix

p, l, u = scipy.linalg.lu(cov)
du = u.diagonal()
c = numpy.linalg.det(p) * numpy.prod(numpy.sign(du))
logdet = log(c) + log(numpy.abs(du)).sum()