[英]How to apply a factor analysis applying spearman correlation to the principal() in R?
To test it can be used the mtcars which have non-parametric distribution.要测试它,可以使用具有非参数分布的 mtcars。 I am developing a factor analysis.
我正在开发一个因素分析。 My data is non-parametric in nature.
我的数据本质上是非参数的。 Therefore, according to the literature, it is recommended to apply the Spearman test.
因此,根据文献,推荐应用Spearman检验。 I'm using fuction:
我正在使用功能:
root.fa2 <- principal(dt,
nfactors = 3,
rotate = 'varimax',
scores=T,
residuals =T,
oblique.scores=T,
method="regression",
spearman="cor",
use = "all.obs")
By default, she uses the option cor = "cor" applying the Person test.默认情况下,她使用选项cor = "cor"应用 Person 测试。 However, this is indicated for parametric data.
但是,这适用于参数数据。 The spearman = "cor" option is valid for the function. However, this error is returning -> Error in stats::varimax(loadings, ...): unused argument (spearman = "cor").
spearman = "cor"选项对 function 有效。但是,此错误返回 -> Error in stats::varimax(loadings, ...): unused argument (spearman = "cor")。 This only happens when I define a nfactors > 1.
只有当我定义nfactors > 1 时才会发生这种情况。
The documentation is not a clear as it might be here, but looking at the documentation for MixedCor
the following works and gives you your scores:该文档可能并不清晰,因为它可能在这里,但查看
MixedCor
的文档以下工作并为您提供分数:
root.fa2 <- principal(mtcars, nfactors = 3,
rotate = 'varimax', scores=TRUE, residuals=TRUE, oblique.scores=TRUE,
method="regression", use = "all.obs", cor="spearman")
Note.笔记。 It is good practice to spell out
TRUE
and FALSE
since they are reserved words.最好拼出
TRUE
和FALSE
,因为它们是保留字。 T
and F
will usually work, but they are not reserved so that you can accidentally assign T
or F
to a value in some other part of your code. T
和F
通常会起作用,但它们不是保留的,因此您可能会不小心将T
或F
分配给代码其他部分的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.