turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-24-2012 09:58 AM

I did an EM-algorithm for latent variable model with missing biomarkers and coviates in SAS IML. There is an overflow error in the DET of a 159X159 matrix. I have to use Log-likelihood function(LF) to control the iteration times and it includes the determinant.

What are the possible approaches to solve this problem?

Thanks for any help in advance!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to renc

10-24-2012 10:18 AM

The determinant is a polynomial in the entries, and is therefore known to be unstable for large matrices.

Are you using the determinant to find out if a matrix is singular? If so, there are better (more stable) ways to determine singularity.

Or does the determinant appear in the LL formula and you need to compute it explicitly? If so, compute the log-determinant (which should be stable) and exponentiate, assuming the log-det is less than CONSTANT('LOGBIG').

Is the matrix positive definite (a correlation or covariance matrix)? If so, you can compute the log-det as follows:

Let G = root(A) be the Cholesky root of the matrix A.

Then log(det(A)) = log(det(G`*G)) = log(det(G`)*det(G)) = 2*log(det(G))

Since G is triangular, det(G) = prod(diag(G)) and therefore log(det(G))=sum(diag(G)).

So your formula for log(det(A)) is 2*sum(log(diag(root(A)))). In SAS/IML you would use the VECDIAG function to get the diagonal elements of a matrix.

Message was edited by: Rick Wicklin

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

10-24-2012 11:05 AM

Thank you, Rick. The idea is very good and helpful. The formula might be log(det(A))= 2*log(det(root(A))). If det(root(A)) is still overflow, we may need to use all eigenvalues of A to calculate the log(det(A)).

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to renc

10-24-2012 11:14 AM

You're free to try it, but computing det(root(A)) is only a minor improvement over det(A). The whole point is to get rid of det(LargeMatrix).

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to renc

10-24-2012 12:55 PM

Rats, I omitted a 'log' in the final formula, which is probably what confused you. I will edit my original post to correct it.