如何在 R 中创建并行分析屏幕?

How can I create a parallel analysis scree in R?

数据集输出

structure(list(V1 = structure(c(4, 4, 2, 2, 2, 2, 2, 2, 4, 4, 
2, 3, 2, 3, 4, 2, 2, 2, 3, 3, 2, 3, 1, 3, 3, 3, 3, 4, 1, 2, 4, 
1, 2, 3, 2, 3, 1, 1, 2, 2, 4, 3, 2, 1, 2, 3, 3, 4, 3, 3, 2, 3, 
1, 4, 3, 2, 3, 4, 1, 3, 3, 3, 2, 2, 1, 2, 3, 4, 4, 2, 4, 3, 2, 
3, 3, 3, 3, 2, 4, 3, 3, 3, 2, 2, 3, 4, 2, 4, 4, 2, 2, 3, 3), format.spss = "F8.0"), 
    V2 = structure(c(4, 4, 3, 4, 3, 4, 3, 2, 4, 1, 3, 3, 3, 4, 
    3, 3, 2, 3, 4, 3, 1, 4, 2, 3, 4, 2, 4, 3, 3, 2, 3, 2, 3, 
    3, 4, 3, 3, 3, 3, 3, 3, 2, 4, 2, 2, 2, 4, 3, 4, 4, 2, 4, 
    2, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 3, 3, 4, 4, 4, 4, 4, 
    3, 4, 3, 3, 3, 4, 2, 4, 3, 4, 3, 3, 2, 3, 3, 4, 3, 4, 3, 
    4, 4, 3), format.spss = "F8.0"), V3 = structure(c(4, 4, 4, 
    4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 
    3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 
    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4), format.spss = "F8.0"), 
    V4 = structure(c(4, 4, 3, 4, 3, 4, 2, 1, 3, 2, 3, 1, 4, 4, 
    2, 3, 2, 2, 2, 4, 1, 2, 2, 2, 3, 2, 3, 2, 2, 1, 3, 1, 1, 
    2, 4, 1, 1, 2, 3, 2, 2, 1, 1, 1, 3, 2, 4, 3, 3, 3, 3, 3, 
    3, 4, 3, 1, 4, 3, 4, 3, 2, 3, 2, 1, 4, 1, 4, 1, 2, 4, 4, 
    4, 3, 3, 3, 2, 2, 1, 4, 3, 2, 3, 2, 1, 3, 4, 1, 2, 4, 3, 
    4, 2, 2), format.spss = "F8.0"), V5 = structure(c(3, 3, 3, 
    4, 3, 4, 3, 1, 1, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 2, 
    2, 2, 2, 4, 2, 3, 2, 3, 4, 1, 4, 2, 3, 3, 2, 2, 3, 2, 2, 
    3, 3, 2, 3, 3, 3, 2, 2, 2, 3, 2, 3, 3, 2, 2, 3, 3, 2, 3, 
    2, 2, 3, 3, 3, 2, 3, 3, 3, 4, 3, 2, 3, 3, 3, 3, 3, 3, 4, 
    3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 4, 3, 3), format.spss = "F8.0"), 
    V6 = structure(c(4, 4, 3, 4, 3, 4, 4, 1, 3, 3, 3, 3, 2, 3, 
    4, 2, 4, 3, 3, 3, 3, 4, 4, 3, 3, 3, 4, 4, 4, 3, 4, 4, 3, 
    3, 3, 4, 2, 2, 3, 3, 3, 4, 2, 4, 3, 4, 4, 4, 3, 4, 2, 4, 
    3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 3, 1, 4, 4, 4, 4, 4, 4, 
    4, 3, 4, 4, 4, 4, 2, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 3, 
    4, 4, 4), format.spss = "F8.0"), V7 = structure(c(4, 4, 2, 
    4, 2, 4, 4, 3, 3, 3, 2, 2, 4, 4, 3, 3, 1, 4, 3, 3, 1, 2, 
    4, 3, 4, 2, 4, 4, 3, 3, 2, 2, 3, 2, 4, 3, 3, 3, 3, 3, 3, 
    1, 4, 3, 2, 2, 4, 3, 4, 4, 2, 4, 2, 3, 4, 3, 3, 3, 4, 3, 
    4, 4, 3, 4, 4, 3, 4, 4, 4, 4, 3, 4, 4, 4, 3, 3, 4, 3, 4, 
    3, 3, 3, 3, 2, 2, 4, 4, 4, 4, 2, 4, 4, 3), format.spss = "F8.0"), 
    V8 = structure(c(4, 4, 2, 1, 2, 1, 1, 1, 3, 3, 2, 3, 2, 3, 
    4, 2, 2, 2, 3, 3, 2, 3, 1, 3, 3, 3, 3, 4, 1, 2, 4, 1, 2, 
    3, 2, 3, 1, 1, 2, 2, 3, 1, 1, 1, 2, 3, 3, 4, 3, 3, 2, 3, 
    1, 3, 4, 2, 3, 4, 1, 3, 3, 3, 2, 2, 1, 2, 3, 4, 4, 2, 4, 
    3, 4, 4, 4, 4, 3, 2, 4, 3, 3, 3, 2, 2, 3, 4, 2, 4, 4, 2, 
    1, 3, 4), format.spss = "F8.0"), V9 = structure(c(4, 4, 4, 
    4, 4, 4, 4, 4, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 2, 3, 4, 4, 
    4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 4, 3, 2, 4, 3, 4, 
    4, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, 3, 4, 3, 2, 4, 
    3, 3, 4, 4, 4, 3, 4, 4, 4, 4, 4, 3, 4, 3, 4, 3, 4, 4, 4, 
    4, 3, 4, 4, 4, 4, 4, 3, 2, 4, 4, 4, 4, 4), format.spss = "F8.0"), 
    V10 = structure(c(4, 4, 2, 4, 2, 4, 3, 2, 3, 3, 3, 2, 4, 
    4, 2, 2, 1, 3, 4, 4, 1, 4, 2, 3, 3, 2, 4, 3, 2, 3, 3, 1, 
    3, 2, 4, 3, 2, 3, 3, 3, 3, 1, 2, 4, 2, 3, 4, 4, 3, 3, 2, 
    4, 2, 4, 3, 3, 4, 3, 4, 3, 4, 4, 4, 1, 4, 3, 3, 4, 3, 4, 
    4, 3, 3, 3, 3, 3, 4, 1, 4, 3, 3, 3, 3, 2, 3, 4, 4, 2, 4, 
    2, 4, 4, 3), format.spss = "F8.0"), V11 = structure(c(3, 
    3, 1, 4, 1, 4, 1, 1, 1, 1, 2, 1, 1, 1, 3, 2, 2, 2, 2, 1, 
    2, 3, 1, 2, 3, 3, 2, 1, 2, 2, 2, 3, 2, 2, 3, 2, 1, 2, 2, 
    1, 1, 4, 3, 1, 3, 2, 3, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 3, 
    2, 2, 2, 2, 2, 2, 1, 1, 1, 3, 3, 4, 2, 1, 2, 2, 3, 3, 3, 
    3, 4, 3, 2, 3, 3, 2, 2, 2, 2, 1, 3, 1, 4, 1, 3), format.spss = "F8.0"), 
    V12 = structure(c(4, 4, 3, 2, 3, 2, 3, 1, 3, 3, 3, 3, 2, 
    3, 3, 2, 4, 3, 3, 4, 4, 3, 3, 4, 4, 3, 3, 3, 4, 3, 4, 4, 
    3, 3, 3, 4, 2, 2, 3, 3, 3, 4, 2, 4, 3, 4, 4, 4, 3, 4, 2, 
    4, 3, 3, 3, 3, 4, 3, 3, 2, 2, 1, 1, 3, 1, 4, 4, 4, 4, 4, 
    4, 4, 3, 3, 2, 2, 2, 2, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 
    3, 2, 3, 4), format.spss = "F8.0")), class = c("tbl_df", 
"tbl", "data.frame"), row.names = c(NA, -93L))

碎石地块前的 EFA

我已经完成了对数据进行探索性因素分析的工作:

fa3 <- fa(hwk2,
   nfactors = 3,
   n.obs = 93,
   rotate = "oblimin",
   max.iter = 100)
fa3

这给了我这个:

      MR1   MR3   MR2   h2   u2 com
V1   0.03  0.87 -0.05 0.77 0.23 1.0
V2   0.75  0.05  0.09 0.63 0.37 1.0
V3   0.13  0.06  0.67 0.53 0.47 1.1
V4   0.50  0.07  0.08 0.31 0.69 1.1
V5   0.03 -0.06  0.88 0.77 0.23 1.0
V6   0.00  0.47  0.32 0.37 0.63 1.8
V7   0.80 -0.08 -0.04 0.60 0.40 1.0
V8   0.05  0.88 -0.03 0.80 0.20 1.0
V9  -0.22  0.02  0.58 0.34 0.66 1.3
V10  0.75  0.10  0.01 0.63 0.37 1.0
V11  0.03  0.00  0.53 0.29 0.71 1.0
V12 -0.24  0.52  0.14 0.28 0.72 1.6

                       MR1  MR3  MR2
SS loadings           2.18 2.09 2.03
Proportion Var        0.18 0.17 0.17
Cumulative Var        0.18 0.36 0.53
Proportion Explained  0.35 0.33 0.32
Cumulative Proportion 0.35 0.68 1.00

 With factor correlations of 
     MR1  MR3  MR2
MR1 1.00 0.32 0.19
MR3 0.32 1.00 0.15
MR2 0.19 0.15 1.00

基本屏幕

从那里制作普通的碎石地块非常简单。我只是将其添加到我的脚本中:

scree(hwk2,
      pc=T,
      factors = F,
      main = "Scree Plot of Eigenvalues")

创建这个的:

我想要的

但是,我想用它绘制模拟并行分析图。在 Jamovi 中,这非常容易实现:

但是,到目前为止我还没有看到这个选项。我试过另一个版本的 scree fa.parallel 但传说真的很奇怪:

fa.parallel(
  hwk2,
  n.obs = 93,
  fm = "minres",
  nfactors = 3,
  main = "Parallel Analysis Scree Plots",
  n.iter = 100,
  error.bars = FALSE,
  se.bars = FALSE,
  SMC = FALSE,
  ylabel = NULL,
  show.legend = F,
  sim = TRUE,
  quant = .95,
  use = "pairwise",
  plot = TRUE,
  correct = .5
)

如果我删除图例,我会得到:

或者我得到这个令人讨厌的传说:

基本上,我只需要因子分析,不需要图中的主成分,但我不知道如何删除它。

唯一的问题是有Heywood cases,所以fa分析不可信。

library(psych)

fa.parallel(
  hwk2,
  n.obs = 93,
  fa = "fa",                # you want only "fa", not "pc"
  show.legend = TRUE,       # show legend
  fm = "minres",
  nfactors = 3,
  main = "Parallel Analysis Scree Plots",
  n.iter = 100,
  error.bars = FALSE,
  se.bars = FALSE,
  SMC = FALSE,
  ylabel = NULL,
  sim = TRUE,
  quant = .95,
  use = "pairwise",
  plot = TRUE,
  correct = .5
)