alka seltzer
2004-Feb-06 15:47 UTC
[R] How to get the pseudo left inverse of a singular squarem atrix?
>I'm rusty, but not *that* rusty here, I hope. > >If W (=Z*Z' in your case) is singular, it can nothave >inverse, which by>definition also mean that nothing multiply by it will >produce the identity >matrix (for otherwise it would have an inverse and >thus nonsingular). > >The definition of a generalized inverse is something >like: If A is a >non-null matrix, and G satisfy AGA = A, then G is >called a generalized >inverse of A. This is not unique, but a unique one >that satisfy some >additional properties is the Moore-Penrose inverse.I >don't know if this is>what ginv() in MASS returns, as I have not used it >before.Andy The inverse of a Matrix A is defined as a Matrix B such that B*A=A*B=I and not just B*A=I. But there are matrices B for singular matrices A such that B*A=I but A*B != I, therefore there exist "left-inverses" (or "right-inverses") for non-invertable matrices. Best Regards __________________________________
Spencer Graves
2004-Feb-06 16:17 UTC
[R] How to get the pseudo left inverse of a singular squarem atrix?
The documentation for "ginv" in MASS says it "Calculates the Moore-Penrose generalized inverse of a matrix 'X'." The theory says that for each m x n matrix A, there is a unique n x m matrix G satisfying AGA = A and GAG = G. (http://mathworld.wolfram.com/Moore-PenroseMatrixInverse.html). Consider the following simple example:> A <- array(c(1,1,0,0), dim=c(2,2))[2,] 0.0 0.0> A[,1] [,2] [1,] 1 0 [2,] 1 0> ginv(A)[,1] [,2] [1,] 0.5 0.5 [2,] 0.0 0.0> ginv(A)%*%A[,1] [,2] [1,] 1 0 [2,] 0 0> A%*%ginv(A)[,1] [,2] [1,] 0.5 0.5 [2,] 0.5 0.5> A%*%ginv(A)%*%A[,1] [,2] [1,] 1 0 [2,] 1 0> ginv(A)%*%A%*%ginv(A)[,1] [,2] [1,] 0.5 0.5 [2,] 0.0 0.0 hope this helps. spencer graves alka seltzer wrote:>>I'm rusty, but not *that* rusty here, I hope. >> >>If W (=Z*Z' in your case) is singular, it can not >> >> >have >inverse, which by > > >>definition also mean that nothing multiply by it will >>produce the identity >>matrix (for otherwise it would have an inverse and >>thus nonsingular). >> >>The definition of a generalized inverse is something >>like: If A is a >>non-null matrix, and G satisfy AGA = A, then G is >>called a generalized >>inverse of A. This is not unique, but a unique one >>that satisfy some >>additional properties is the Moore-Penrose inverse. >> >> >I >don't know if this is > > >>what ginv() in MASS returns, as I have not used it >>before. >> >> > >Andy > > >The inverse of a Matrix A is defined as a Matrix B >such that B*A=A*B=I and not just B*A=I. But there are >matrices B for singular matrices A such that B*A=I but >A*B != I, therefore there exist "left-inverses" (or >"right-inverses") for non-invertable matrices. > >Best Regards > >__________________________________ >>______________________________________________ >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 > >