问题
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?
回答1:
as promised by William Revelle, as of 1.5.8
, psych
also returns the rotation matrices for factor analyses and principal components analysis.
This solves the problem, continuing the above example:
principalrot$rot.mat == varimaxres$rotmat # it works!
来源:https://stackoverflow.com/questions/32157031/how-can-i-retrieve-impute-the-underlying-rotation-matrix-rotmat-from-psych