如何对 R 中的 principal() 应用斯皮尔曼相关性的因子分析?

How to apply a factor analysis applying spearman correlation to the principal() in R?

为了测试它可以使用具有非参数分布的 mtcars。 我正在开发一个因素分析。我的数据本质上是非参数的。因此,根据文献,推荐应用Spearman检验。我正在使用功能:

root.fa2 <- principal(dt, 
                  nfactors = 3, 
                  rotate = 'varimax',
                  scores=T, 
                  residuals =T,
                  oblique.scores=T,
                  method="regression",
                  spearman="cor",
                  use = "all.obs")

默认情况下,她使用选项 cor = "cor" 应用 Person 测试。但是,这适用于参数数据。 spearman = "cor" 选项对该函数有效。但是,此错误正在返回 -> stats::varimax(loadings, ...) 中的错误:未使用的参数 (spearman = "cor")。只有当我定义 nfactors > 1.

时才会发生这种情况

文档可能并不清晰,但查看 MixedCor 的文档可以得出以下结果:

root.fa2 <- principal(mtcars, nfactors = 3, 
        rotate = 'varimax', scores=TRUE, residuals=TRUE, oblique.scores=TRUE,
        method="regression", use = "all.obs", cor="spearman")

注意。最好拼出 TRUEFALSE,因为它们是保留字。 TF 通常可以工作,但它们不是保留的,因此您可能会不小心将 TF 分配给代码其他部分的值。