[R] g-inverse question

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Mar 25 22:41:33 CET 2004


Do read the help file!

ginv has a tolerance, and your matrix is below it: it is computationally 
singular to the tolerance of 1e-8.  Try changing the tolerance ....

On Thu, 25 Mar 2004, Richard Valliant wrote:

> I am using the ginv function from MASS and have run across this problem
> that I do not understand.  If I define the matrix A as below, its
> g-inverse does not satisfy the Moore-Penrose condition 
>  
> A %*% ginv(A) %*% A = A.
>  
> The matrix A is X'WX in a quadratic regression using some very large
> dollar values. 
> The much simpler matrix B does satisfy the MP condition. Am I doing
> something wrong? Is this due to the large values in A?
>  
> I am using v.1.8.1 on Windows XP.
>  
> > A <- matrix(c(15, 20157302,20157302,68854740000000), ncol=2, byrow
> =T)
> > A
>          [,1]         [,2]
> [1,]       15 2.015730e+07
> [2,] 20157302 6.885474e+13
> > ginv(A)
>              [,1]         [,2]
> [1,] 1.244696e-27 4.251721e-21
> [2,] 4.251721e-21 1.452333e-14
> > A %*% ginv(A) %*% A
>              [,1]         [,2]
> [1,] 5.901073e+00 2.015730e+07
> [2,] 2.015730e+07 6.885474e+13
> > B
>      [,1] [,2]
> [1,]    1    2
> [2,]    2    1
> > B %*% ginv(B) %*% B
>      [,1] [,2]
> [1,]    1    2
> [2,]    2    1
> 
>  
> Thanks in advance,
>  
>  
> Richard Valliant, Ph.D.
> University of Maryland
> Joint Program for Survey Methodology
> 1218 Lefrak Hall
> College Park MD 20742
> (301)-405-0932
> FAX: (301) 314-7912
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list