[R] ginv and matlab's pinv give different results

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Feb 24 20:02:56 CET 2008



Pedro Mardones wrote:
> Dear all;
> I'm kind of confused with the results obtained using the ginv function
> from package MASS and pinv function from Matlab. Accroding to the
> documentation both functions performs a Moore-Penrose generalized
> inverse of a matrix X. The problem is when I change the tolerance
> value, say to 1E-3.
> 
> Here is some output from ginv
> 195.2674402	235.6758714	335.0830253	8.977515484	-291.7798965
> 428.8266383	165.9809056	284.0561017	-74.35007018	-210.3373981
> 440.6537582	42.44715935	290.4538488	-58.74366626	-86.71457799
> 246.4469887	-36.24936825	397.6034028	-107.7574448	10.7545897
> -17.07138404	30.43896492	399.3831596	-88.49681959	12.33524917
> 
> 
> ad here from pinv
> 1.988794963	4.931306729	-12.72706642	-3.903229019	-4.516082822
> 3.017403231	4.799144574	-14.43317599	-5.388596501	-5.872449411
> 4.951830097	4.684716091	-17.13075023	-6.584430072	-7.142673623
> 7.457154317	2.896685565	-21.59318352	-11.38286985	-10.58210901
> 7.841116927	0.836247791	-23.12560946	-13.99460333	-11.8333927
> 
> I'm sure it must be some explanation that I'm not aware of. If anyone
> can (want) to run the test I can email the data set

Without the original data we cannot say if one or both of them are wrong 
or correct. Hence, please make the data and the code you have used 
available - as the posting guide suggests.

Uwe Ligges


> Thanks for any idea
> 
> PM
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list