| sp | sex | index | FL | RW | CL | CW | BD |
|---|---|---|---|---|---|---|---|
| B | M | 1 | 8.1 | 6.7 | 16.1 | 19.0 | 7.0 |
| B | M | 2 | 8.8 | 7.7 | 18.1 | 20.8 | 7.4 |
| B | M | 3 | 9.2 | 7.8 | 19.0 | 22.4 | 7.7 |
| B | M | 4 | 9.6 | 7.9 | 20.1 | 23.1 | 8.2 |
| B | M | 5 | 9.8 | 8.0 | 20.3 | 23.0 | 8.2 |
| B | M | 6 | 10.8 | 9.0 | 23.0 | 26.5 | 9.8 |
Principal Component Analysis (PCA) is a statistical method used to reduce dimensionality while retaining most of the original variance. In simple terms, PCA helps to simplify complex data sets by focusing on the most important parts that capture the majority of the variation in the data.
Leptograpsus variegatus
The dataset has 200 rows and 8 columns, describing 5 morphological measurements on 50 crab each of two color forms and both sexes:
| Column | Description |
|---|---|
sp |
species – B or O for blue or orange |
sex |
as it says |
index |
index 1:50 within each of the four groups |
FL |
frontal lobe size (mm) |
RW |
rear width (mm) |
CL |
carapace length (mm) |
CW |
carapace width (mm) |
BD |
body depth (mm) |
FL (frontal lobe size),RW (rear width),CL (carapace length),CW (carapace width), orBD (body depth)?FL (frontal lobe) & RW (rear width)prcomp() result| Element | Description |
|---|---|
sdev |
Standard deviations of the principal components. |
rotation |
Loadings of original variables on principal components. |
center |
Logical indicating if data were centered. |
scale |
Logical indicating if data were scaled. |
x |
Principal component scores (transformed data). |
rank |
Rank of the original data matrix. |
call |
Call that generated the “prcomp” object. |
centering |
Centering values (mean values of original variables). |
scaling |
Scaling values (standard deviations of variables). |
List of 5
$ sdev : num [1:5] 2.1883 0.3895 0.2159 0.1055 0.0414
$ rotation: num [1:5, 1:5] 0.452 0.428 0.453 0.451 0.451 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:5] "FL" "RW" "CL" "CW" ...
.. ..$ : chr [1:5] "PC1" "PC2" "PC3" "PC4" ...
$ center : Named num [1:5] 15.6 12.7 32.1 36.4 14
..- attr(*, "names")= chr [1:5] "FL" "RW" "CL" "CW" ...
$ scale : Named num [1:5] 3.5 2.57 7.12 7.87 3.42
..- attr(*, "names")= chr [1:5] "FL" "RW" "CL" "CW" ...
$ x : num [1:200, 1:5] -4.92 -4.38 -4.12 -3.87 -3.82 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:200] "1" "2" "3" "4" ...
.. ..$ : chr [1:5] "PC1" "PC2" "PC3" "PC4" ...
- attr(*, "class")= chr "prcomp"
In PCA, projections are the positions of your original data points on the new principal component axes. They represent how the data looks when viewed from the perspective of the principal components, simplifying complex, multi-dimensional data into a more manageable form.
| sp | sex | PC1 | PC2 | PC3 | PC4 | PC5 |
|---|---|---|---|---|---|---|
| B | M | -4.915239 | 0.2677733 | 0.1219517 | -0.0390459 | 0.0692952 |
| B | M | -4.375197 | 0.0938381 | 0.0391337 | 0.0054535 | -0.0030446 |
| B | M | -4.118329 | 0.1684532 | -0.0335594 | 0.0380015 | 0.0379655 |
| B | M | -3.873960 | 0.2453925 | -0.0144647 | 0.0190459 | 0.0013117 |
| B | M | -3.824458 | 0.2236052 | 0.0150296 | 0.0544971 | -0.0248217 |
| B | M | -2.945564 | 0.2194700 | -0.0383320 | -0.0696657 | 0.0189264 |
Loadings in PCA are the coefficients that multiply each standard unit of the original variables to get the principal component scores. Loadings are weights indicating the contribution of each variable to each principal component.
| Variable | PC1 | PC2 | PC3 | PC4 | PC5 | |
|---|---|---|---|---|---|---|
| FL | FL | 0.4520437 | 0.1375813 | 0.5307684 | 0.6969234 | 0.0964916 |
| RW | RW | 0.4280774 | -0.8981307 | -0.0119791 | -0.0837032 | -0.0544176 |
| CL | CL | 0.4531910 | 0.2682381 | -0.3096816 | -0.0014446 | -0.7916827 |
| CW | CW | 0.4511127 | 0.1805959 | -0.6525696 | 0.0891878 | 0.5745267 |
| BD | BD | 0.4511336 | 0.2643219 | 0.4431610 | -0.7066364 | 0.1757433 |