Thanks in advance. I used the PCA function from the FactoMineR package to get estimates of the main components. I tried reading through the package information and similar questions on this forum, but I canโt understand the code to rotate the extracted components (either orthogonal or oblique).
I know that the princomp function and the main function in the psych package have rotational abilities, but I really like the ability of the PCA to scale variables to one. Any help would be greatly appreciated. Thanks.
IIUC:
library(FactoMineR) data(iris) Iris <- iris[,1:4] res <- PCA(Iris, graph=F) #rotation t(apply(res$var$coord, 1, function(x) {x/sqrt(res$eig[,1])})) Dim.1 Dim.2 Dim.3 Dim.4 Sepal.Length 0.5210659 0.37741762 -0.7195664 -0.2612863 Sepal.Width -0.2693474 0.92329566 0.2443818 0.1235096 Petal.Length 0.5804131 0.02449161 0.1421264 0.8014492 Petal.Width 0.5648565 0.06694199 0.6342727 -0.5235971 #check prcomp(Iris, scale=T) Rotation: PC1 PC2 PC3 PC4 Sepal.Length 0.5210659 -0.37741762 0.7195664 0.2612863 Sepal.Width -0.2693474 -0.92329566 -0.2443818 -0.1235096 Petal.Length 0.5804131 -0.02449161 -0.1421264 -0.8014492 Petal.Width 0.5648565 -0.06694199 -0.6342727 0.5235971
Alternative line of code if you want to get downloads from a PCA object:
PCA
sweep(res$var$coord, 2, sqrt(res$eig[,1]),'/')