[R] Matrix inverse

Douglas Bates bates at stat.wisc.edu
Mon May 1 15:33:44 CEST 2000


gb <gb at stat.umu.se> writes:

> How about 'Ainv <- qr.solve(A)'?
> 
> I happened to read the help page for 'qr.solve' the other day, and there I
> found that qr.solve(A, b) "is == but much better than solve(A) %*% b".
> (I guess that 'better than' refers to numerical stability?)

The "better than" refers to the fact that creating the inverse is
more-or-less equivalent to solving n systems of linear equations,
where n is the number of columns in A.  If n is large it does not make
sense to compute the solutions to n systems of equations in order to
evaluate the solution to one system of equations.

> Is qr.solve generally to be preferred to solve, which seems to be
> indicated by the cited help page? And what is hidden behind solve?

I think if you check the code for solve you will find that it usually
calls qr.solve.  qr.solve is just one method of solving a linear
system of equations.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list