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. Mlod
On Tue, 27 Apr 2004 23:02:37 +0000, "Tomek R" <rtomek at hotmail.com> wrote:>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
How do you wish to decide how to resolve the likely inconsistencies in the overdetermined system? If you assume the vertical deviations from a linear fit are normally distributed with constant variance, then "lm" should do what you want. hope this helps. spencer graves Tomek R wrote:> 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. > > Mlod > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html
lm.fit(A, b)$coefficients seems to do what I want, but, as you have rightly pointed out, the deviations most probably will not have constant variance (but should be normally distributed). Basically, I make measurements from which I obtain the vector b with variance in each of the values v. How would I fit my data then? (A is known and fixed). What's the best book to look at for solving those problems? Thanks, Tomek> How do you wish to decide how to resolve the likely inconsistencies >in the overdetermined system? If you assume the vertical deviations from a >linear fit are normally distributed with constant variance, then >"lm" should do what you want._________________________________________________________________