This function runs many existing procedures for determining how many factors to retain/extract from factor analysis (FA) or dimension reduction (PCA). It returns the number of factors based on the maximum consensus between methods. In case of ties, it will keep the simplest model and select the solution with the fewer factors.
n_factors(
x,
type = "FA",
rotation = "varimax",
algorithm = "default",
package = c("nFactors", "psych"),
cor = NULL,
safe = TRUE,
...
)
n_components(
x,
type = "PCA",
rotation = "varimax",
algorithm = "default",
package = c("nFactors", "psych"),
cor = NULL,
safe = TRUE,
...
)
x  A data frame. 

type  Can be 
rotation  Only used for VSS (Very Simple Structure criterion, see

algorithm  Factoring method used by VSS. Can be 
package  Package from which respective methods are used. Can be

cor  An optional correlation matrix that can be used (note that the
data must still be passed as the first argument). If 
safe  If 
...  Arguments passed to or from other methods. 
A data frame.
n_components
is actually an alias for n_factors
, with
different defaults for the function arguments.
There is also a
plot()
method
implemented in the
seepackage.
n_components()
is a convenient short for n_factors(type = "PCA")
.
Bartlett, M. S. (1950). Tests of significance in factor analysis. British Journal of statistical psychology, 3(2), 7785.
Bentler, P. M., & Yuan, K. H. (1996). Test of linear trend in eigenvalues of a covariance matrix with application to data analysis. British Journal of Mathematical and Statistical Psychology, 49(2), 299312.
Cattell, R. B. (1966). The scree test for the number of factors. Multivariate behavioral research, 1(2), 245276.
Finch, W. H. (2019). Using Fit Statistic Differences to Determine the Optimal Number of Factors to Retain in an Exploratory Factor Analysis. Educational and Psychological Measurement.
Zoski, K. W., & Jurs, S. (1996). An objective counterpart to the visual scree test for factor analysis: The standard error scree. Educational and Psychological Measurement, 56(3), 443451.
Zoski, K., & Jurs, S. (1993). Using multiple regression to determine the number of factors to retain in factor analysis. Multiple Linear Regression Viewpoints, 20(1), 59.
Nasser, F., Benson, J., & Wisenbaker, J. (2002). The performance of regressionbased variations of the visual scree for determining the number of common factors. Educational and psychological measurement, 62(3), 397419.
Golino, H., Shi, D., Garrido, L. E., Christensen, A. P., Nieto, M. D., Sadana, R., & Thiyagarajan, J. A. (2018). Investigating the performance of Exploratory Graph Analysis and traditional techniques to identify the number of latent factors: A simulation and tutorial.
Golino, H. F., & Epskamp, S. (2017). Exploratory graph analysis: A new approach for estimating the number of dimensions in psychological research. PloS one, 12(6), e0174035.
Revelle, W., & Rocklin, T. (1979). Very simple structure: An alternative procedure for estimating the optimal number of interpretable factors. Multivariate Behavioral Research, 14(4), 403414.
Velicer, W. F. (1976). Determining the number of components from the matrix of partial correlations. Psychometrika, 41(3), 321327.
library(parameters)
if (require("nFactors", quietly = TRUE) && require("EGAnet", quietly = TRUE)) {
n_factors(mtcars, type = "PCA")
result < n_factors(mtcars[1:5], type = "FA")
as.data.frame(result)
summary(result)
# \donttest{
n_factors(mtcars, type = "PCA", package = "all")
n_factors(mtcars, type = "FA", algorithm = "mle", package = "all")
# }
}
#>
#> Attaching package: ‘nFactors’
#> The following object is masked from ‘package:lattice’:
#>
#> parallel
#>
#> EGAnet (version 0.9.8)
#> For help getting started, type browseVignettes("EGAnet")
#> For bugs and errors, submit an issue to <https://github.com/hfgolino/EGAnet/issues>
#>
#> NEW: EGAnet will write your Methods section for you. Type ?methods.section for more details
#> # Method Agreement Procedure:
#>
#> The choice of 3 dimensions is supported by 9 (36.00%) methods out of 25 (Bartlett, CNG, SE Scree, R2, EGA (glasso), EGA (TMFG), Velicer's MAP, BIC, BIC).