[R] princomp and eigen

Bjørn-Helge Mevik bhs2 at mevik.net
Sun Jul 16 06:29:12 CEST 2006


Murray Jorgensen wrote:

>  > set.seed(160706)
>  > X <- matrix(rnorm(40),nrow=10,ncol=4)
>  > Xpc <- princomp(X,cor=FALSE)
>  > summary(Xpc,loadings=TRUE, cutoff=0)
> Importance of components:
>                            Comp.1    Comp.2    Comp.3     Comp.4
> Standard deviation     1.2268300 0.9690865 0.7918504 0.55295970
[...]
>
> I would have expected the princomp component standard deviations to be 
> the square roots of the eigen() $values and they clearly are not.

It's an 1/n vs. 1/(n-1) thing:

> eX <- eigen(var(X))
> sqrt(eX$values)
[1] 1.2931924 1.0215069 0.8346836 0.5828707
> sqrt(9/10 * eX$values)
[1] 1.2268300 0.9690865 0.7918504 0.5529597

-- 
Bjørn-Helge Mevik



More information about the R-help mailing list