![](/img/trans.png)
[英]How to apply a function for Spearman's rank correlation coefficient in R?
[英]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"選項對 function 有效。但是,此錯誤返回 -> Error in stats::varimax(loadings, ...): unused argument (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")
筆記。 最好拼出TRUE
和FALSE
,因為它們是保留字。 T
和F
通常會起作用,但它們不是保留的,因此您可能會不小心將T
或F
分配給代碼其他部分的值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.