PRINCIPAL+COMPONENTS+IN+R - 1.00 Proportion Var 0.25 0.25...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
PRINCIPAL COMPONENTS IN R > cereal <- read.csv("Cereal_1.csv" , header=T ) > dim(cereal) [1] 6 5 > cereal ID calories protein fat sodium 1 1 70 4 1 130 2 2 120 3 5 15 3 3 70 4 1 260 4 4 50 4 0 140 5 5 110 2 2 200 6 6 110 2 2 180 > cereal.pc<-princomp(cereal[,2:5], cor=FALSE, scale=TRUE, scores=TRUE) > summary(cereal.pc) Importance of components: Comp.1 Comp.2 Comp.3 Comp.4 Standard deviation 75.9420673 24.55596131 6.533657e-01 1.385014e-01 Proportion of Variance 0.9052777 0.09465224 6.700846e-05 3.011102e-06 Cumulative Proportion 0.9052777 0.99992998 9.999970e-01 1.000000e+00 > loadings(cereal.pc) Loadings: Comp.1 Comp.2 Comp.3 Comp.4 calories 0.124 0.991 protein -0.593 0.804 fat -0.805 -0.592 sodium -0.992 0.124 Comp.1 Comp.2 Comp.3 Comp.4 SS loadings 1.00 1.00 1.00
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1.00 Proportion Var 0.25 0.25 0.25 0.25 Cumulative Var 0.25 0.50 0.75 1.00 &gt; plot(cereal.pc) &gt; biplot(cereal.pc) Comp.1 Comp.2 Comp.3 Comp.4 cereal.pc Variances 1000 2000 3000 4000 5000-0.6-0.4-0.2 0.0 0.2 0.4 0.6 0.8-0.6-0.4-0.2 0.0 0.2 0.4 0.6 0.8 Comp.1 Comp.2 1 2 3 4 5 6-200-100 100 200-200-100 100 200 calories protein fat odium &gt; cereal.pc$scores Comp.1 Comp.2 Comp.3 Comp.4 1 21.694214 -21.231907 0.1306381 0.27912282 2 142.048869 14.208632 -0.6517168 -0.05735773 3 -107.290683 -5.067823 -1.1047120 -0.02525065 4 9.279921 -39.846628 0.5401222 -0.17890619 5 -42.788076 27.212254 0.4478073 -0.03221746 6 -22.944246 24.725472 0.6378612 0.01460922 &gt; cereal.scores&lt;-cereal.pc$scores &gt; var(cereal.scores[,1]) [1] 6920.637...
View Full Document

This note was uploaded on 12/26/2010 for the course CPSC 499 taught by Professor Staff during the Spring '08 term at University of Illinois, Urbana Champaign.

Page1 / 3

PRINCIPAL+COMPONENTS+IN+R - 1.00 Proportion Var 0.25 0.25...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online