简体   繁体   中英

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. 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. 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. Among them, nfact is the number of factors with eigen values > eigen values of random data -- what we want.

So the code to extract number of factors suggested from fa.parallel function is like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM