Log of Determinant

This should be a well known methodology by now, but it seems to not be.

In statistical work, one frequently sees the expression \log{|A|} where the absolute value means determinant of covariance matrix A. With large covariances, the calculations can easily overflow, but usually the finally value is a reasonable finite number.

The covariance is key, as it allows us to compute a Cholesky decomposition of A = LL' first, which is quite numerically stable. We will have two triangular matrices whose determinants are the products of their diagonals (proof left as an exercise to the reader). Taking the log of that will transform the product to a sum!

Thus \log{|A|} = 2\sum \log{d(L)} where d is the diagonals of the matrices. You’ll find that this will rarely overflow, and possibly (depending on how sophisticated the determinant calculation is) speed up the work!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.