Re: [R] solve() versus ginv()

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Sun 16 Oct 2005 - 17:23:07 EST

Werner Bier <aliscla@yahoo.com> writes:

> Dear All,
>
> While inverting a matrix the following error appears on my console:
>
> Error in solve.default(my_matrix) : Lapack routine dgesv: system is exactly singular
>
> With this respect, I have been replacing the solve() function with ginv(): the Moore-Penrose generalized inverse of a matrix.
>
> These are the questions I would like to ask you:
>
> 1. Would you also replace solve() with ginv() in these scenarios and using R?
> 2. Or is there something I should take care by using ginv() you would suggest me please?

Well, generalized inverses work by setting 1/0 == 0, broadly speaking. If the system has a zero eigenvalue, the r.h.s. is projected onto the span of the matrix. (In the symmetric, positive semidefinite case, anyway).

In statistical terms, this means that there is a direction along which you have no information on your parameters (infinite s.e.), and the g.inv. solves this by assuming that the effect in that direction is zero (with zero s.e.!). This can be a sensible thing to do, but I wouldn't be happy about having the choice made for me automatically...

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sun Oct 16 17:28:59 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:56:05 EST