[R] Principle Component Analysis

Shawn Way sway at tanox.com
Sat Aug 18 01:12:11 CEST 2001


I have the manual for S+ 6 and I'm trying to use R for the Principle
Component Analysis example and I'm getting a few interesting answers...

The log is as follows:

R : Copyright 2001, The R Development Core Team
Version 1.3.0  (2001-06-22)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.

R is a collaborative project with many contributors.
Type `contributors()' for more information.

Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.


> library(mva)
> data <- read.table("h:/test.txt",header=T,sep="")
> data
   diffgeom complex algebra reals statistics
1        36      58      43    36         37
2        62      54      50    46         52
3        31      42      41    40         29
4        76      78      69    66         81
5        46      56      52    56         40
6        12      42      38    38         28
7        39      46      51    54         41
8        30      51      54    52         32
9        22      32      43    28         22
10        9      40      47    30         24
11       32      49      54    37         52
12       40      62      51    40         49
13       64      75      70    66         63
14       36      38      58    62         62
15       24      46      44    55         49
16       50      50      54    52         51
17       42      42      52    38         50
18        2      35      32    22         16
19       56      53      42    40         32
20       59      72      70    66         62
21       28      50      50    42         63
22       19      46      49    40         30
23       36      56      56    54         52
24       54      57      59    62         58
25       14      35      38    29         20
> summary(testscores.prc)
Importance of components:
                           Comp.1     Comp.2     Comp.3     Comp.4
Comp.5
Standard deviation     28.4896795 9.03547104 6.60095491 6.13358179
3.72335754
Proportion of Variance  0.8212222 0.08260135 0.04408584 0.03806395
0.01402668
Cumulative Proportion   0.8212222 0.90382353 0.94790936 0.98597332
1.00000000
> summary(testscores.prc,loadings=T)
Importance of components:
                           Comp.1     Comp.2     Comp.3     Comp.4
Comp.5
Standard deviation     28.4896795 9.03547104 6.60095491 6.13358179
3.72335754
Proportion of Variance  0.8212222 0.08260135 0.04408584 0.03806395
0.01402668
Cumulative Proportion   0.8212222 0.90382353 0.94790936 0.98597332
1.00000000

Loadings:
           Comp.1 Comp.2 Comp.3 Comp.4 Comp.5
diffgeom   -0.598 -0.675  0.185  0.386       
complex    -0.361 -0.245 -0.249 -0.829 -0.247
algebra    -0.302  0.214 -0.211 -0.135  0.894
reals      -0.389  0.338 -0.700  0.375 -0.321
statistics -0.519  0.570  0.607        -0.179
> print(testscores.prc,loadings=T)
Call:
princomp(x = data)

Standard deviations:
   Comp.1    Comp.2    Comp.3    Comp.4    Comp.5 
28.489680  9.035471  6.600955  6.133582  3.723358 

 5  variables and  25 observations.



Any thoughts as to what I'm doing wrong??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010817/49bb93be/attachment.html


More information about the R-help mailing list