Dear Julie Josse,
With some delay, thank you very much for your helpful answer.
If you ever find the time, could I follow up with 2 related questions?
1) I noticed that the (varimax rotated) loadings computed as you suggest differ from those computed by the "principal" function (psych).
I also noticed that, if I directly perform varimax on the res.pca$var$coord (thus skipping the following line you suggested: loadings.pca= sweep(res.pca$var$coord,2,sqrt(res.pca$eig[1:ncol(res.pca$var$coord),1]),FUN="/"). Then loading values do coincide with those provided by principal from psych.
Here is a working example:
# As you suggested:
pca.res=PCA(iris[,-5], ncp=2, graph=F)
loadings.pca= sweep(pca.res$var$coord,2,sqrt(pca.res$eig[1:ncol(pca.res$var$coord),1]),FUN="/")
loadings.pcarot= varimax(loadings.pca)$loadings
pca.res$var$coord = loadings.pcarot
principal.res=principal(iris[,-5], nfactors=2, rotate="varimax")
cbind(principal.res$loadings, pca.res$var$coord)
# The 2 loadings differ.
pca.res=PCA(iris[,-5], ncp=2, graph=F)
# loadings.pca= sweep(pca.res$var$coord,2,sqrt(pca.res$eig[1:ncol(pca.res$var$coord),1]),FUN="/") # Now skipping this line of code:
loadings.pcarot= varimax(pca.res$var$coord)$loadings
# In the line above, instead of running varimax on the loadings, I run it
# directly on the variable coordinates
pca.res$var$coord = loadings.pcarot
cbind(principal.res$loadings, pca.res$var$coord)
# Now they are nearly identical.
Do you know why this may be? Is this perhaps a terminological issue?
2) I'm guessing that, if we've now rotated the PCs, individual scores should change accordingly. Is this not the case? If so, since we've replaced res.pca$var$coord with the rotated loadings, wouldn't we have to do the same for res.pca$ind$coord in order to produce a biplot of rotated components? Could you kindly provide a line that specifies what res.pca$ind$coord should be replaced with? In short, res.pca$ind$coord=?
Ultimately, I'd like to produce a res.pca$ind$coord that is as close as possible to principal$scores, so I can then use the factominer biplot packages (which as I mentioned, I think are super useful!)
Thanks again for any tips.
Best,
Gabe