Re: [R] ginv vs. solve

2003-08-14 Thread Peter Dalgaard BSA
Angel [EMAIL PROTECTED] writes: Why do x-b%*%ginv(A) and x-solve(A,b) give different results?. It seems that I am missing some basic feature of matrix indexing. e.g.: A-matrix(c(0,-4,4,0),nrow=2,ncol=2) b-c(-16,0) x-b%*%ginv(A);x x-solve(A,b);x [ginv() is from MASS, please remember

Re: [R] ginv vs. solve

2003-08-14 Thread Uwe Ligges
Uwe Ligges wrote: Angel wrote: Why do x-b%*%ginv(A) Why should it be the same??? Here, you are calculating (A+ is G-Inverse) x = b * A+ Let me add: More exactly, you are calculating x = b' * A+ because b * A+ doesn't fit and R is somehow intelligent here and transposes b for you instead

[R] ginv vs. solve

2003-08-14 Thread Angel
Why do x-b%*%ginv(A) and x-solve(A,b) give different results?. It seems that I am missing some basic feature of matrix indexing. e.g.: A-matrix(c(0,-4,4,0),nrow=2,ncol=2) b-c(-16,0) x-b%*%ginv(A);x x-solve(A,b);x Thanks in advance, Angel __ [EMAIL

Re: [R] ginv vs. solve

2003-08-07 Thread Torsten Hothorn
Why do x-b%*%ginv(A) and x-solve(A,b) give different results?. they do (in cases the solution to A x = b is unique): R A - matrix(c(0,-4,4,0),nrow=2,ncol=2) R A [,1] [,2] [1,]04 [2,] -40 R b - c(-16,0) R x1 - ginv(A) %*% b - NOT b %*% ginv(A) R x1 [,1] [1,]