I'm using psych::principal
in another function, with various rotate
functions passed to principal
.
(principal
offers many rotation options and passes them on to different other functions).
I need to get the rotation matrix that whichever rotation procedure was used found, and implemented.
All of the downstream rotation procedures offer this, but it appears not to be return()
ed by principal
.
For example:
randomcor <- cor(matrix(data = rnorm(n = 100), nrow = 10))
library(psych)
principalres <- principal(r = randomcor, nfactors = 3, rotate = "none")
unrot.loa <- unclass(principalres$loadings)
principalrot <- principal(r = randomcor, nfactors = 3, rotate = "varimax") # there is no way to retrieve the rot.mat from principal
# but this CAN be done from the underlying varimax!
varimaxres <- varimax(x = unrot.loa)
varimaxres$rotmat # see, THIS is what I want!
I am loathe to re-implement all of the rotation procedures from principal
.
(Don't repeat yourself, or someone else, as the say).
Does anyone have an idea how:
- I could elegantly, somehow, magically, retrieve
rotmat
fromprincipal()
, though it appears not to return it? - I could, alternatively, impute whichever
rotmat
must have "happened", because I know the rotated and unrotated loadings?