[R] Matrix inversion

From: Ben Domingue <ben.domingue_at_gmail.com>
Date: Mon, 18 Feb 2008 20:05:53 -0700


Howdy,
I am trying to invert a matrix for the purposes of least squares. I have tried a number of things, and the variety of results has me confused.
1. When I try solve() I get the following:
>Error in solve.default(t(X) %*% X) : system is computationally
singular: reciprocal condition number = 3.76391e-20 2. When I try qr.solve(), I get:
>Error in qr.solve(t(X) %*% X) : singular matrix 'a' in solve
3. I can, however, use lm(y~X) to get coefficients. This confuses me since I thought that lm() used qr(). So why did qr.solve() not work earlier?
4. I have even tried using ginv(). The process works, but I end up with a different set of regression coefficients after I finish the process than what I had with lm(). To the best of my knowledge, this shouldn't happen.

I've been digging around all day and can't figure this out. Thanks,

Ben Domingue
PhD Student, School of Education
University of Colorado at Boulder



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 19 Feb 2008 - 03:09:12 GMT

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 Tue 19 Feb 2008 - 06:30:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive