[英]R Psych package: extract factor number from fa.parallel function
I conducted a parallel analysis with the Psych
package in R. I want to extract the number of factors from the output of fa.parallel()
function, and save it to a variable for further processing.我使用 R 中的
Psych
包进行了并行分析。我想从fa.parallel()
函数的输出中提取因子的数量,并将其保存到变量中以供进一步处理。 I checked the document but did not find how to do it.我检查了文档,但没有找到如何去做。
My code is like:我的代码是这样的:
fa.parallel(cor(data), n.obs=nrow(data), fa="fa", n.iter=100, main="Scree plots with parallel analysis")
Output is a scree plot with:输出是一个碎石图,其中:
Parallel analysis suggests that the number of factors = 2 and the number of components = NA
I want to extract "2" in this case.在这种情况下,我想提取“2”。 How should I achieve it?
我应该如何实现它?
Thanks in advance.提前致谢。
This document psych: Procedures for Psychological, Psychometric, and Personality Research (P160) lists the return values of fa.parallel
function.本文档psych:心理、心理测量和人格研究程序(P160) 列出了
fa.parallel
函数的返回值。 Among them, nfact
is the number of factors with eigen values > eigen values of random data -- what we want.其中,
nfact
是随机数据特征值>特征值的因子个数——我们想要的。
So the code to extract number of factors suggested from fa.parallel
function is like this:因此,从
fa.parallel
函数中提取建议的因子数量的代码如下所示:
parallel <- fa.parallel(cor(data), n.obs=nrow(data), fa="fa", n.iter=100, main="Scree plots with parallel analysis")
parallel$nfact #number of factors
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.