Re: [問題] How to solve Ax=b that A is not inve …

作者: brooky (未夠班)   2006-04-16 10:02:32
※ 引述《Yyh (我愛批踢踢)》之銘言:
: ※ 引述《brooky (未夠班)》之銘言:
: Thank you! I have solved it :p
Do you get similar coefficient from SVD and from other methods (like qr)?
I use
x ^-1 = v %*% w^-1 %*% t(u)
coef = x^-1 %*% y
but some coefficients are somehow different.
############
using SVD
############
[1] 9.625310e-01 1.400204e-01 1.879135e+00 1.636499e+00 2.847722e-17
[6] 1.649529e-01 8.469963e+00 -6.853315e-02 -2.800156e+00 3.833104e+00
[11] -3.537933e-01 3.290799e+00 -8.728223e-03 -8.457266e-02
############
using lm
############
(Intercept) x1 x2 x3 x4
4.340299e+01 1.400204e-01 1.717815e-01 -4.267582e-01 NA
x5 x6 x7 x8 x9
-1.114267e+02 8.469963e+00 -6.853315e-02 -2.800156e+00 2.553855e+00
x10 x11 x12 x13
NA NA -8.728223e-03 -8.457266e-02
############
code segment
############
d_minus[d_minus > 1e-07] <- 1/d_minus[d_minus > 1e-07];
d_minus[d_minus <= 1e-07] <- 0;
x_minus <- v %*% diag(d_minus) %*% t(u);
coef <- x_minus %*% y;
I think I may have misunderstood how SVD works. (?)
I would appreciate any clarification on this.
Thanks,

Links booklink

Contact Us: admin [ a t ] ucptt.com