[R] Rank of matrix
Martin Maechler
maechler at stat.math.ethz.ch
Tue Aug 4 10:47:35 CEST 2009
>>>>> "AR" == Alex Roy <alexroy2008 at gmail.com>
>>>>> 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 to do with R,
even though you provide R code here:.
Please learn about this, maybe from Wikipedia:
http://en.wikipedia.org/wiki/Rank_%28linear_algebra%29
>> X<-matrix((rnorm(10000)),50) dim(X)
AR> [1] 50 200
>> qr(X)$rank
AR> [1] 50
>> X[,2]<-X[,30] qr(X)$rank
AR> [1] 50
>> X[10,]<-X[7,] qr(X)$rank
AR> [1] 49
Note that the rank of a matrix is well defined in theoretical
linear algebra, but in practice is quite a bit more complicated.
For this reason, and to bring this back to a topic more fit to R-help :
The package 'Matrix' (typically part of R, since R 2.9.0),
has a function
rankMatrix()
whose options {and implementation; just type 'rankMatrix' !}
show you a bit about the problematics.
Regards,
Martin Maechler, ETH Zurich
More information about the R-help
mailing list