Among the most important decisions for an exploratory factor analysis (EFA) is the choice of the number of factors to retain. Several factor retention criteria have been developed for this. With this function, various factor retention criteria can be performed simultaneously. Additionally, the data can be checked for their suitability for factor analysis.
N_FACTORS(
x,
criteria = c("CD", "EKC", "HULL", "KGC", "PARALLEL", "SCREE", "SMT"),
suitability = TRUE,
N = NA,
use = c("pairwise.complete.obs", "all.obs", "complete.obs", "everything",
"na.or.complete"),
cor_method = c("pearson", "spearman", "kendall"),
n_factors_max = NA,
N_pop = 10000,
N_samples = 500,
alpha = 0.3,
max_iter_CD = 50,
n_fac_theor = NA,
method = c("PAF", "ULS", "ML"),
gof = c("CAF", "CFI", "RMSEA"),
eigen_type_HULL = c("SMC", "PCA", "EFA"),
eigen_type_other = c("PCA", "SMC", "EFA"),
n_factors = 1,
n_datasets = 1000,
percent = 95,
decision_rule = c("means", "percentile", "crawford"),
show_progress = TRUE,
...
)
A list of class N_FACTORS containing
A list with the outputs from BARTLETT
and
KMO
and the factor retention criteria.
A named vector containing the suggested number of factors from each factor retention criterion.
A list of the settings used.
data.frame or matrix. Dataframe or matrix of raw data or matrix with
correlations. If "CD"
is included as a criterion, x must be raw
data.
character. A vector with the factor retention methods to
perform. Possible inputs are: "CD"
, "EKC"
, "HULL"
,
"KGC"
, "PARALLEL"
, "SCREE"
, and "SMT"
(see details). By default, all factor retention methods are performed.
logical. Whether the data should be checked for suitability
for factor analysis using the Bartlett's test of sphericity and the
Kaiser-Guttmann criterion (see details). Default is TRUE
.
numeric. The number of observations. Only needed if x is a correlation matrix.
character. Passed to stats::cor
if raw
data is given as input. Default is "pairwise.complete.obs"
.
character. Passed to stats::cor
Default is "pearson"
.
numeric. Passed to CD
.The maximum number
of factors to test against.
Larger numbers will increase the duration the procedure takes, but test more
possible solutions. Maximum possible is number of variables / 2. Default is
NA. If not specified, number of variables / 2 is used.
numeric. Passed to CD
. Size of finite populations
of comparison data. Default is 10000.
numeric. Passed to CD
. Number of samples drawn
from each population. Default is 500.
numeric. Passed to CD
. The alpha level used to test
the significance of the improvement added by an additional factor.
Default is .30.
numeric. Passed to CD
. The maximum number of
iterations to perform after which the iterative PAF procedure is halted.
Default is 50.
numeric. Passed to HULL
. Theoretical number
of factors to retain. The maximum of this number and the number of factors
suggested by PARALLEL plus one will be used in the Hull method.
character. Passed to EFA
in HULL
,
KGC
, SCREE
, and PARALLEL
. The
estimation method to use. One of "PAF"
, "ULS"
, or "ML"
,
for principal axis factoring, unweighted least squares, and maximum
likelihood, respectively.
character. Passed to HULL
. The goodness of fit index
to use. Either "CAF"
, "CFI"
, or "RMSEA"
, or any
combination of them. If method = "PAF"
is used, only
the CAF can be used as goodness of fit index. For details on the CAF, see
Lorenzo-Seva, Timmerman, and Kiers (2011).
character. Passed to PARALLEL
in
HULL
. On what the
eigenvalues should be found in the parallel analysis. Can be one of
"SMC"
, "PCA"
, or "EFA"
. If using "SMC"
(default),
the diagonal of the correlation matrices is
replaced by the squared multiple correlations (SMCs) of the indicators. If
using "PCA"
, the diagonal values of the correlation
matrices are left to be 1. If using "EFA"
, eigenvalues are found on the
correlation matrices with the final communalities of an EFA solution as
diagonal.
character. Passed to KGC
,
SCREE
, and PARALLEL
. The same as eigen_type_HULL,
but multiple inputs
are possible here. Default is to use all inputs, that is, c("PCA",
"SMC", "EFA"
)
numeric. Passed to PARALLEL
(also within
HULL
), KGC
, and SCREE
. Number of
factors to extract if "EFA"
is included in eigen_type_HULL
or
eigen_type_other
. Default is 1.
numeric. Passed to PARALLEL
(also within
HULL
). The number of datasets to simulate. Default is 1000.
numeric. Passed to PARALLEL
(also within
HULL
). A vector of percentiles to take the simulated eigenvalues
from. Default is 95.
character. Passed to PARALLEL
(also within
HULL
). Which rule to use to determine the number of
factors to retain. Default is "means"
, which will use the average
simulated eigenvalues. "percentile"
, uses the percentiles specified
in percent. "crawford"
uses the 95th percentile for the first factor
and the mean afterwards (based on Crawford et al, 2010).
logical. Whether a progress bar should be shown in the console. Default is TRUE.
Further arguments passed to EFA
in
PARALLEL
(also within HULL
) and KGC
.
By default, the entered data are checked for suitability for factor analysis using the following methods (see respective documentations for details):
Bartlett's test of sphericity (see BARTLETT
)
Kaiser-Meyer-Olkin criterion (see KMO
)
The available factor retention criteria are the following (see respective documentations for details):
Comparison data (see CD
)
Empirical Kaiser criterion (see EKC
)
Hull method (see HULL
)
Kaiser-Guttman criterion (see KGC
)
Parallel analysis (see PARALLEL
)
Scree plot (see SCREE
)
Sequential chi-square model tests, RMSEA lower bound, and AIC
(see SMT
)
# \donttest{
# All criteria, with correlation matrix and fit method "ML" (where needed)
# This will throw a warning for CD, as no raw data were specified
nfac_all <- N_FACTORS(test_models$baseline$cormat, N = 500, method = "ML")
# The same as above, but without "CD"
nfac_wo_CD <- N_FACTORS(test_models$baseline$cormat, criteria = c("EKC",
"HULL", "KGC", "PARALLEL", "SCREE", "SMT"), N = 500,
method = "ML")
# Use PAF instead of ML (this will take a lot longer). For this, gof has
# to be set to "CAF" for the Hull method.
nfac_PAF <- N_FACTORS(test_models$baseline$cormat, criteria = c("EKC",
"HULL", "KGC", "PARALLEL", "SCREE", "SMT"), N = 500,
gof = "CAF")
# Do KGC and PARALLEL with only "PCA" type of eigenvalues
nfac_PCA <- N_FACTORS(test_models$baseline$cormat, criteria = c("EKC",
"HULL", "KGC", "PARALLEL", "SCREE", "SMT"), N = 500,
method = "ML", eigen_type_other = "PCA")
# Use raw data, such that CD can also be performed
nfac_raw <- N_FACTORS(GRiPS_raw, method = "ML")
# }
Run the code above in your browser using DataLab