[R] PCA and % variance explained
Gad Abraham
gabraham at csse.unimelb.edu.au
Wed Sep 10 10:10:37 CEST 2008
pgseye wrote:
> After doing a PCA using princomp, how do you view how much each component
> contributes to variance in the dataset. I'm still quite new to the theory of
> PCA - I have a little idea about eigenvectors and eigenvalues (these
> determine the variance explained?). Are the eigenvalues related to loadings
> in R?
You can plot the princomp object using screeplot() and you can get the
percentage of explained variance from the princomp object p using
p$sdev^2 / sum(p$sdev^2)
--
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