[R] Dimensions of svd V matrix

Gad Abraham gabraham at csse.unimelb.edu.au
Fri May 16 13:34:16 CEST 2008


Hi,

I'm trying to do PCA on a n by p wide matrix (n < p), and I'd like to 
get more principal components than there are rows. However, svd() only 
returns a V matrix of with n columns (instead of p) unless the argument 
nv=p is set (prcomp calls svd without setting it). Moreover, the 
eigenvalues returned are always min(n, p) instead of p, even if nv is set:

 > x <- matrix(rnorm(15), 3, 5)
 > dim(svd(x)$v)
[1] 5 3
 > length(svd(x)$d)
[1] 3
 > dim(svd(x, nv=5)$v)
[1] 5 5
 > length(svd(x, nv=5)$d)
[1] 3
 >

Is there a way of getting more PCs and eigenvalues than rows? Is the 
eigen-decomposition of the covariance matrix really that numerically 
bad? (i.e., eigen(cov(x)) )

Thanks,
Gad

-- 
Gad Abraham
Dept. CSSE and NICTA
The University of Melbourne
Parkville 3010, Victoria, Australia
email: gabraham at csse.unimelb.edu.au
web: http://www.csse.unimelb.edu.au/~gabraham



More information about the R-help mailing list