Learn R Programming

sasLM (version 1.0.1)

g2inv: Generalized type 2 inverse matrix, g2 inverse

Description

A generalized inverse is usually not unique. Some programs use this algorithm to get a unique generalized inverse matrix. This uses the SWEEP operator and works for non-square matrices also.

Usage

g2inv(A, eps=1e-08)

Value

g2 inverse

Arguments

A

a matrix to be inverted

eps

A value less than this is considered zero.

Author

Kyun-Seop Bae k@acr.kr

Details

See 'SAS Technical Report R106, The Sweep Operator: Its Importance in Statistical Computing' by J. H. Goodnight for details.

References

Searle SR, Khuri AI. Matrix Algebra Useful for Statistics. 2e. John Wiley and Sons Inc. 2017.

See Also

G2SWEEP

Examples

Run this code
  A = matrix(c(1, 2, 4, 3, 3, -1, 2, -2, 5, -4, 0, -7), byrow=TRUE, ncol=4) ; A
  g2inv(A)

Run the code above in your browser using DataLab