Re: [R] Can't reproduce clusplot princomp results.

From: Bjørn-Helge Mevik <bhx2_at_mevik.net>
Date: Tue 24 May 2005 - 17:19:54 EST

Thomas M. Parris writes:

> clusplot reports that the first two principal components explain
> 99.7% of the variability.
[...]

>> loadings(pca)
[...]
> Comp.1 Comp.2 Comp.3 Comp.4
> SS loadings 1.00 1.00 1.00 1.00
> Proportion Var 0.25 0.25 0.25 0.25
> Cumulative Var 0.25 0.50 0.75 1.00

This has nothing to do with how much of the variability of the original data that is captured by each component; it merely measures the variability in the coefficients of the loading vectors (and they are standardised to length one in princomp)

What you want to look at is pca$sdev, for instance something like

totvar <- sum(pca$sdev^2)

rbind("explained var" = pca$sdev^2,
      "prop. expl. var" = pca$sdev^2/totvar,
      "cum.prop.expl.var" = cumsum(pca$sdev^2)/totvar)
                     Comp.1    Comp.2      Comp.3       Comp.4
explained var     3.4093746 0.5785399 0.011560142 0.0005252824
prop. expl. var 0.8523437 0.1446350 0.002890036 0.0001313206 cum.prop.expl.var 0.8523437 0.9969786 0.999868679 1.0000000000

And as you can see, two comps "explain" 99.7%. :-)

-- 
Bjørn-Helge Mevik

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue May 24 17:22:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:01 EST