Matrix Inversion
Wang Chengbin wrote:
I got the following error:
a = read.csv("mat.csv")
b = as.matrix(a)
tb = t(b)
bb = tb %*% b
dim(bb)
ibb = solve(bb)
bb %*% ibb
ibb = solve(bb)
Error in solve.default(bb) : system is computationally singular: reciprocal condition number = 1.77573e-19 Are there any ways to find more information about why it is singular? Thanks.
Yes. Since the matrix is positive semidefinite by construction, I'd probably go for chol(bb, pivot=TRUE), then the first "rank" elements of "pivot" gives you a maximal subset of linearly independent columns, and you can proceed by something like lm(b[,-subset]~b[,subset]) to see what the linear dependencies are. (Other approaches could be eigen() and svd().)
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907