[R] Solving linear equations

Duncan Murdoch dmurdoch at pair.com
Wed Apr 28 01:12:04 CEST 2004

On Tue, 27 Apr 2004 23:02:37 +0000, "Tomek R" <rtomek at hotmail.com>

>Is there a simple method under R to solve an overdetermined system of linear 
>equations Ax=b with A being a matrix m*n? I know that solve() seems to work 
>for m*m matrices, but I had no luck with overdetermined systems.

Isn't that just a linear regression problem?  You can get x as

lm.fit(A, b)$coefficients

or go lower level and use 

qr.coef(qr(A), b)

Duncan Murdoch

More information about the R-help mailing list