Re: [Rd] Catching errors from solve() with near-singular matrices

From: Jon Clayden <>
Date: Tue, 11 Dec 2012 15:43:27 +0000

Dear David,

I can think of two strategies for dealing with this problem:
> Strategy 1: Some code like this:
> if (det(X) < epsilon) {
> warning("Near singular matrix")
> return(NULL)
> }
> return(solve(X))

This solution is probably the easiest one to take, but to match solve.default, the test should be

  if (rcond(X) < .Machine$double.eps)

Catching that case should avoid the error. I hope this helps.

All the best,

        [[alternative HTML version deleted]] mailing list Received on Wed 12 Dec 2012 - 06:38:59 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Dec 2012 - 18:42:50 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive