This storage contains R scripts and an RDS file that can be used to predict the number of factors for an EFA application with the tuned xgboost model presented in our article: "One model to rule them all? Using machine learning algorithms to determine the number of factors in exploratory factor analysis".
When using this model, keep in mind that it is trained for specific data conditions and should not be carelessly adopted to every real-world example. Since different contexts require different models, we are working on new models tailored to other data conditions. The model yielded a high predictive accuracy (99.3% out-of-sample accuracy) on multivariate normal data with one to eight underlying factors, up to 80 manifest items, variables per factor between four and ten as well as orthogonal and oblique factor structures.
When you want to apply the xgboost model to empirical data, please download the provided folder containing the pre-trained model and all scripts (Note: Maintain the folder structure).
Then you can simply run the script "Analysis Script.R" inserting your own empirical data set in the function call factor.forest().
When using this method, please cite our article:
Goretzko, D., & Bühner, M. (2020). One model to rule them all? Using machine learning algorithms to determine the number of factors in exploratory factor analysis. *Psychological Methods*. doi: 10.1037/met0000262