副手/手动/判断因子/组件旋转是否有良好的包装?

时间:2015-07-05 20:02:23

标签: r pca rotational-matrices psych

我正在尝试向手动添加(或手动,或判断旋转从主成分分析到qmethod R包的因子加载矩阵。 手动旋转如下:1指定旋转任何给定因子对的角度。 (是的,它很奇怪,但在Q Methodology中有意义。)

目前,我正在寻找交互式GUI(虽然这真的很棒),但只是一个CLI界面,您可以按left或{{1}并获得更新的图表,最后说right

传统PQMethod计划的基线是这样的。 enter image description here 这是a short video

我当前的方法是使用OK,并在此基础上编写一个有点互动(如psych::factor.rotate()rightleft)CLI界面的程序图。

不过,我想知道某人是否还没有这样做

我用Google搜索了,但是很短(甚至找不到OK以外的副手旋转程序。

有什么建议吗?

Ps:如果你有关于如何使用交互式GUI进行此操作的建议,可以获得奖励。

Pps:有人愿意为此添加psych::factor.rotate()标签吗?我没有必要的观点。

1 个答案:

答案 0 :(得分:1)

我试试manipulate - 在下面的静脉:

library(psych)
library(manipulate)
l <- l_orig <- unclass(loadings(principal(Harman.5, 2, scores=TRUE)))
manipulate( 
  { 
    if(rotateRight) 
      l <<- factor.rotate(l, angle, 1, 2)
    if (rotateLeft)
      l <<- factor.rotate(l, -1*angle, 1, 2)

    plot(l, xlim = c(-1, 1), ylim = c(-1, 1), xlab = 1, ylab = 2); abline(v = 0); abline(h = 0)
  }, 
  angle = slider(1, 90, step=1, initial = 1, label = "Angle"), 
  rotateRight = button(">"),
  rotateLeft = button("<")
)
l; l_orig

enter image description here