[Rd] prcomp scale error (PR#6433)

ryszard.czerminski at pharma.novartis.com ryszard.czerminski at pharma.novartis.com
Thu Jan 15 15:31:25 MET 2004


Full_Name: Ryszard Czerminski
Version: 1.8.1
OS: GNU/Linux
Submission from: (NULL) (205.181.102.120)


prcomp(..., scale = TRUE) does not work correctly:

$ uname -a
Linux 2.4.20-28.9bigmem #1 SMP Thu Dec 18 13:27:33 EST 2003 i686 i686 i386
GNU/Linux
$ gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

> a <- matrix(rnorm(6), nrow = 3)
> sum((scale(a %*% svd(cov(a))$u, scale = F)[,1] - (prcomp(a, scale =
F)$x)[,1])^2)
[1] 2.465190e-31
> sum((scale(a %*% svd(cov(a))$u, scale = T)[,1] - (prcomp(a, scale =
T)$x)[,1])^2)
[1] 0.5493767



More information about the R-devel mailing list