Re: [R] rank of Matrix

2011-03-31 Thread Carson Farmer
Hmm, looks like I'm 'answering' my own question here... library(Matrix) data(KNex) mm <- KNex$mm str(mmQR <- qr(mm)) # new stuff: R <- mmQR@R Rdiag <- diag(R) rank <- sum(Rdiag > max(dim(mm))*.Machine$double.eps*abs(R[1,1])) # this is the matlab default I think? # 712 for comparison, rankMatrix f

[R] rank of Matrix

2011-03-31 Thread Carson Farmer
Dear list, Can anyone tell me how to obtain the rank of a sparse Matrix, for example from package Matrix (class dgCMatrix)? Here is an example of QR decomposition of a sparse matrix (from the sparseQR class help). library(Matrix) data(KNex) mm <- KNex$mm str(mmQR <- qr(mm)) Similarly, using the

Re: [R] Rank of matrix

2009-08-04 Thread Martin Maechler
> "AR" == Alex Roy > on Tue, 4 Aug 2009 09:56:42 +0200 writes: AR> Dear all, Rank of a matrix depends on which factors? AR> Only on rows or coumns? or both ? If there is a AR> collinearlity in the variables ( columns ) does it AR> effects the rank? This has nothing

[R] Rank of matrix

2009-08-04 Thread Alex Roy
Dear all, Rank of a matrix depends on which factors? Only on rows or coumns? or both ? If there is a collinearlity in the variables ( columns ) does it effects the rank? > X<-matrix((rnorm(1)),50) > dim(X) [1] 50 200 > qr(X)$rank [1] 50 > X[,2]<-X[,30] > qr(X)$rank [1] 50 > X[