[R] Dimensions of svd V matrix

From: Gad Abraham <gabraham_at_csse.unimelb.edu.au>
Date: Fri, 16 May 2008 21:34:16 +1000


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)) )


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

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 16 May 2008 - 11:38:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 16 May 2008 - 17:30:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive