[R] Dimensions of svd V matrix
Gad Abraham
gabraham at csse.unimelb.edu.au
Sat May 17 03:00:16 CEST 2008
Kenn Konstabel wrote:
> I'm not an expert at all, but isn't it that you really want svd(x)$u to
> be different (instead of V)?
>
> that would be easy to do:
>
> x <- matrix(rnorm(15), 3, 5)
>
> s1 <- svd(x)
> s2 <- svd(x, nv=ncol(x))
>
> x1 <- s1$u %*% diag(s1$d) %*% t(s1$v)
> x2 <- cbind(s2$u,1,1) %*% diag(c(s1$d,0,0)) %*% t(s2$v)
>
> all.equal(x,x1,x2)
Yep, you're absolutely correct. As someone's explained to me, the number
of PCs cannot be larger than the rank of the matrix, therefore like you
say the rest of the eigenvalues are practically zero anyway.
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