This is a statistics question--
In STATA, you can specify the minimum eigen value so that the optimal number of factors are chosen.
. forvalues i=1/11{
2. unab vars: `vv`i''
3. di _n(3)"################## vars: `vars' ##################"
4. factor `vv`i'',pcf mineigen(1)
5. rotate
6. alpha `vv`i''
7. }
Both factanal() and psych::principal() require the programmer to specify the exact number of factors in the initial call.
for example:
fit <- factanal(mydata, 3, rotation="varimax")
I know that I can run some further exploration to find the ideal number:
https://www.statmethods.net/advstats/factor.html
# Determine Number of Factors to Extract
library(nFactors)
ev <- eigen(cor(mydata)) # get eigenvalues
ap <- parallel(subject=nrow(mydata),var=ncol(mydata),
rep=100,cent=.05)
nS <- nScree(x=ev$values, aparallel=ap$eigen$qevpea)
plotnScree(nS)
I would like R to decide on the factors to extract, without having to do any exploratory work. Is this possible in R?