| Class | Analysis and data manipulation command |
| Name | pca |
| Arguments | [<quantitative trait 1> <quantitative trait 2> [...<quantitative trait N>]] |
Carries out principal components analysis for the listed traits.
If a single integer (N) is given, this allows entry of the lower triangle of an N by N covariance matrix via the keyboard.
Example:
>> # Example dataset from R datasets package
>> # Originally from
>> # Statistical Abstracts of the United States 1975.(Urban rates).
>> set loc Murder qua
>> set loc Assault qua
>> set loc UrbanPop qua
>> set loc Rape qua
>> read cases inline
>> #ID Murder Assault UrbanPop Rape
>> Alabama 13.2 236 58 21.2
>> Alaska 10 263 48 44.5
>> Arizona 8.1 294 80 31
>> Arkansas 8.8 190 50 19.5
>> California 9 276 91 40.6
>> Colorado 7.9 204 78 38.7
>> Connecticut 3.3 110 77 11.1
>> Delaware 5.9 238 72 15.8
>> Florida 15.4 335 80 31.9
>> Georgia 17.4 211 60 25.8
>> Hawaii 5.3 46 83 20.2
>> Idaho 2.6 120 54 14.2
>> Illinois 10.4 249 83 24
>> Indiana 7.2 113 65 21
>> Iowa 2.2 56 57 11.3
>> Kansas 6 115 66 18
>> Kentucky 9.7 109 52 16.3
>> Louisiana 15.4 249 66 22.2
>> Maine 2.1 83 51 7.8
>> Maryland 11.3 300 67 27.8
>> Massachusetts 4.4 149 85 16.3
>> Michigan 12.1 255 74 35.1
>> Minnesota 2.7 72 66 14.9
>> Mississippi 16.1 259 44 17.1
>> Missouri 9 178 70 28.2
>> Montana 6 109 53 16.4
>> Nebraska 4.3 102 62 16.5
>> Nevada 12.2 252 81 46
>> NewHampshire 2.1 57 56 9.5
>> NewJersey 7.4 159 89 18.8
>> NewMexico 11.4 285 70 32.1
>> NewYork 11.1 254 86 26.1
>> NorthCarolina 13 337 45 16.1
>> NorthDakota 0.8 45 44 7.3
>> Ohio 7.3 120 75 21.4
>> Oklahoma 6.6 151 68 20
>> Oregon 4.9 159 67 29.3
>> Pennsylvania 6.3 106 72 14.9
>> RhodeIsland 3.4 174 87 8.3
>> SouthCarolina 14.4 279 48 22.5
>> SouthDakota 3.8 86 45 12.8
>> Tennessee 13.2 188 59 26.9
>> Texas 12.7 201 80 25.5
>> Utah 3.2 120 80 22.9
>> Vermont 2.2 48 32 11.2
>> Virginia 8.5 156 63 20.7
>> Washington 4 145 73 26.2
>> WestVirginia 5.7 81 39 9.3
>> Wisconsin 2.6 53 66 10.8
>> Wyoming 6.8 161 60 15.6
>> ;;;;
>> run
>> pca
Variable Mean Stand Dev Correlations
---------- ------------ ------------ ---------------------
Murder 7.7880 4.3555 1.00
Assault 170.7600 83.3377 0.80 1.00
UrbanPop 65.5400 14.4748 0.07 0.26 1.00
Rape 21.2320 9.3664 0.56 0.67 0.41 1.00
Number of variables = 4
No. usable observations = 50 ( 100.0%)
Variances for the principal components
2.480 0.9898 0.3566 0.1734
Proportion of total variance due to each component
0.620 0.247 0.089 0.043
Loadings of each variable on components
Murder 0.5359 -0.4182 0.3412 0.6492
Assault 0.5832 -0.1880 0.2681 -0.7434
UrbanPop 0.2782 0.8728 0.3780 0.1339
Rape 0.5434 0.1673 -0.8178 0.0890
| << (cor) | Up to index | >> (tab) |