问题描述
我在另一个函数中使用了psych::principal
,并将各种rotate
函数传递给了principal
.(principal
提供许多旋转选项,并将它们传递给其他不同的函数).
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.
所有下游轮换程序都提供了此功能,但principal
似乎没有对它进行return()
.
All of the downstream rotation procedures offer this, but it appears not to be return()
ed by principal
.
例如:
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!
我不愿重新执行principal
中的所有轮换程序.(俗话说,不要重复自己或别人).
I am loathe to re-implement all of the rotation procedures from principal
. (Don't repeat yourself, or someone else, as the say).
有人知道如何:
- 我可以优雅地以某种方式神奇地从
principal()
检索rotmat
,尽管看起来好像不返回它? - 或者,我可以归因哪个
rotmat
必须发生",因为我知道旋转和未旋转的负载?
- 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?
推荐答案
,正如William Revelle所承诺的那样,从1.5.8
开始,psych
还返回旋转矩阵以进行因子分析和主成分分析.
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!
这篇关于如何从psych :: principal检索/估算底层旋转矩阵(rotmat)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!