I have a mathematical context--a computer program I am writing--in which, if I am dealing with scalars, I have a variance, and at a certain point, I (or rather the program) take its reciprocal, i.e. the variance's multiplicative inverse.

When instead I am dealing with vectors, I use a covariance matrix, and instead of the reciprocal, I take the inverse matrix--again, the (matrix-)multiplicative inverse.

The variance, or the covariance matrix changes over time as I run the same procedures repeatedly.

The procedure can result in a "variance" that's negative, which of course makes no sense. It can also result in a variance that's zero, which might be OK, except that then the program will divide by zero. This is not because of a bug in the code. It's just that the code wasn't intended to be used under certain conditions, but what those conditions are, isn't clear. (Except that it's clear that if the code generates a "variance" $< 0$, those weren't the right conditions!)

One way to avoid "variances" $\leq 0$ would be to force the procedure to return a value just above 0 when it would have otherwise returned a value $\leq 0$. Something like: if sigma <= 0, then assign 0.000001 to sigma. This is easy to implement.

My question: What would the covariance matrix analogue (or analogues) of the test for variance $\leq 0$ be, and why? I have a hypothesis that it's a test for whether the covariance matrix's determinant is greater than 0, but I'm not quite sure why that would make sense.

(I'm not sure whether I have given enough information to make the question answerable. I'm not sure whether I can give enough information, if not, so I hope that I have.)


A covariance matrix should be at least positive semidefinite and typically positive definite.

If the matrix is positive semidefinite than some of your individual RV's are perfectly correlated, which can cause lots of complications. Generally you will want to avoid these and insist on a positive definite covariance matrix.

In case you're not familiar with the definition, a symmetric matrix $A$ is positive semidefinite if $x^{T}Ax \geq 0$ for all $x$ and positive definite if $x^{T}Ax > 0$ for all non-zero $x$. In terms of the eigenvalues of $A$, $A$ is positive semidefinite if the eigenvalues are all greater than or equal to 0 and positive definite if the eigenvalues are strictly greater than 0.

  • $\begingroup$ Thanks--that sounds like it might be just what I need. I'll investigate. $\endgroup$ – Mars Sep 13 '16 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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