How to understand 'prcomp' result?
After running below code, we get prcomp result 'res.pca'.
It include '$ sdev
'/'$ rotation
'/'$ center
'/'$ scale
$ x
',how to understand all of them. Thanks.
library(factoextra)
data("decathlon2")
decathlon.active <- decathlon2[1:23, 1:10]
res.pca <- prcomp(decathlon.active,scales=TRUE)
str(res.pca)
CodePudding user response:
sdev
is the s.d of the principal components and also the squre roots of the eigenvalues of the covariance matrix.
rotation
is a matrix whose columns contain the eigenvectors, the principal components in the original coordinate system.
In PCA, as you set option scales = TRUE
, it scale data decathlon.active
, and those center
and scale
are the centering and scaling used to scale the data.
Finally, x
is the matrix of rotated data, also means the principal components of your data.