how can I retrieve / impute the underlying rotation matrix (rotmat) from psych::principal?
Asked Answered
B

1

0

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 from principal(), though it appears not to return it?
  • I could, alternatively, impute whichever rotmat must have "happened", because I know the rotated and unrotated loadings?
Blinnie answered 22/8, 2015 at 14:6 Comment(1)
the psych package author, William Revelle, just told me that: > I will add that feature in the next release. (coming in about 2 weeks). I'll update the post, once that feature is out.Blinnie
B
0

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!
Blinnie answered 31/8, 2015 at 10:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.