s-news
[Top] [All Lists]

Re: solve

To: Abderrahim Oulhaj <abderrahim.oulhaj@pharmacology.oxford.ac.uk>
Subject: Re: solve
From: Douglas Bates <bates@stat.wisc.edu>
Date: Tue, 14 Dec 2004 12:47:18 -0600
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <012601c4e20b$75a08bf0$adca01a3@optima.ox.ac.uk>
Organization: University of Wisconsin - Madison
References: <012601c4e20b$75a08bf0$adca01a3@optima.ox.ac.uk>
Reply-to: bates@wisc.edu
User-agent: Mozilla Thunderbird 0.9 (X11/20041124)
Abderrahim Oulhaj wrote:

Dear all,
I had something bizarre when I tried to get the inverse of the same matrix with S-plus6.2 and R. > A <- matrix(c(613537.28025, -49.536866569,-49.53687, 0.004000337),nrow = 2, byrow=TRUE) With S-plus: > solve(A)

Problem in solve.qr(a): apparently singular matrix
Use traceback() to see the call stack
With R:
> solve(a)

             [,1]         [,2]
[1,]   0.00880039     108.9767
[2,] 108.97675704 1349728.0536
Explanation?
Abderrahim

It is not bizarre; it is what one would expect from numerical linear algebra. Both responses are reasonably correct. The matrix has a condition number on the order of 10^12 so it is a judgement call whether to regard it as computationally singular.

By the way, this is a symmetric matrix and positive definite so you would be much better off using a Cholesky decomposition for which the condition number is on the order of 10^6.

<Prev in Thread] Current Thread [Next in Thread>