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 from package Matrix gives the same answer, but takes considerably more time and memory! rankMatrix(mm) # 712 Does the above make sense to others? Alternatively, is it possible to derive rank from the model itself (I can't see how)? library(MatrixModels) trial <- data.frame(counts=c(18,17,15,20,10,20,25,13,12), outcome=gl(3,1,9,labels=LETTERS[1:3]), treatment=gl(3,3,labels=letters[1:3])) glmS <- glm4(counts ~ 0+outcome + treatment, family=poisson, data=trial, verbose = TRUE, sparse = TRUE) str(glmS) -- Carson J. Q. Farmer ISSP Doctoral Fellow National Centre for Geocomputation National University of Ireland, Maynooth, http://www.carsonfarmer.com/ ______________________________________________ R-help@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.