# Multivariate Gaussian density from singular covariance

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?

• Perhaps some of the variables are so closely related that they create a collinearity problem? – hejseb Sep 24 '13 at 11:24
• Sorry; no entries of the correlation matrix are 1. – j13r Sep 24 '13 at 11:45

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()