covariance matrix in multivariate Gaussian distribution (semi-positive or positive definite)

1.4k Views Asked by At

The book that I'm reading states clearly that the covariance matrix $\Sigma$ in the following equation is a positive semidefinite and symmetric matrix.

$$ p(x) = det(2\pi\Sigma)^{-1/2} exp\{ -\frac{1}{2} (x-\mu)^{T} \Sigma^{-1}(x-\mu) \} $$

However, when I use mvnpdf() in Matlab, I get an error that the covariance matrix must be a positive definite matrix. Any suggestions?

1

There are 1 best solutions below

0
On

The answer is that Matlab being a numeric software will need to actually compute the PDF using a numeric algorithm and this makes the case where $\Sigma$ is semi-positive-definite or singular problematic. As stated in Matlab's documentation page:

..where $x$ and $\mu$ are 1-by-d vectors and $\Sigma$ is a d-by-d symmetric positive definite matrix. While it is possible to define the multivariate normal for singular $\Sigma$, the density cannot be written as above. Only random vector generation is supported for the singular case. Note that while most textbooks define the multivariate normal with $x$ and $\mu$ oriented as column vectors, for the purposes of data analysis software, it is more convenient to orient them as row vectors, and Statistics Toolbox™ software uses that orientation.