G inverse
Calculates the g-inverse of a squared matrix using the eigen decomposition and removing the eigenvalues smaller than a tolerance.
ginv(X, tol = sqrt(.Machine$double.eps))
X
: Matrix to calculate the g-inversetol
: Tolerance.The function is useful to avoid singularities.
Returns the g-inverse
Jose Luis Vicente Villardon
data(iris) x=as.matrix(iris[,1:4]) S= t(x) ginv(S)
Useful links