Average EFA solutions across estimators, implementations, and rotations
Source:R/efa_average.R
efa_average.RdDifferent EFA procedures can give different solutions. efa_average() fits an
EFA with efa_fit() for each combination of the specified estimators (e.g., ML and
PAF), implementations (e.g., the SPSS and psych implementations of PAF), and
rotations of the same kind (e.g., promax and oblimin). Then it summarises the
solutions. This shows how much a solution depends on these analytic choices.
Usage
efa_average(
x,
n_factors,
N = NA,
estimator = "PAF",
rotation = "promax",
type = "none",
averaging = c("mean", "median"),
trim = 0,
salience_threshold = 0.3,
max_iter = 10000,
init_comm = c("smc", "mac", "unity"),
criterion = c(0.001),
criterion_type = c("sum", "max_individual"),
abs_eigen = c(TRUE),
varimax_type = c("svd", "kaiser"),
normalize = TRUE,
k_promax = 2:4,
k_simplimax = ncol(x),
p_type = c("norm", "unnorm"),
precision = 1e-05,
start_method = c("psych", "factanal"),
use = c("pairwise.complete.obs", "all.obs", "complete.obs", "everything",
"na.or.complete"),
cor_method = c("pearson", "spearman", "kendall", "poly", "tetra", "fiml"),
show_progress = TRUE,
seed = NULL,
P_type = lifecycle::deprecated(),
se = NULL
)Source
Grieder, S., & Steiner, M. D. (2022). Algorithmic jingle jungle: A comparison of implementations of principal axis factoring and promax rotation in R and SPSS. Behavior Research Methods, 54, 54–74. doi: 10.3758/s13428-021-01581-x
Hendrickson, A. E., & White, P. O. (1964). Promax: A quick method for rotation to oblique simple structure. British Journal of Statistical Psychology, 17 , 65–70. doi: 10.1111/j.2044-8317.1964.tb00244.x
Lorenzo-Seva, U., Timmerman, M. E., & Kiers, H. A. L. (2011). The Hull Method for Selecting the Number of Common Factors, Multivariate Behavioral Research, 46, 340-364, doi: 10.1080/00273171.2011.564527
Kaiser, H. F. (1958). The varimax criterion for analytic rotation in factor analysis. Psychometrika, 23, 187–200. doi: 10.1007/BF02289233
Arguments
- x
data.frame or matrix. Raw data or a correlation matrix.
- n_factors
numeric. The number of factors to extract.
- N
numeric. The number of observations. Needed only for a correlation matrix. Without
N, the chi-square-based fit indices areNA.- estimator
character vector. Any combination of "PAF", "ML", and "ULS" ("MINRES" is a synonym for "ULS"). Default is "PAF". "DWLS" is not available, because it needs the asymptotic covariance of polychoric correlations; use
efa_fit()for it.- rotation
character vector. "none"; one or more orthogonal rotations ("varimax", "equamax", "quartimax", "geominT", "bentlerT", and "bifactorT"); or one or more oblique rotations ("promax", "oblimin", "quartimin", "simplimax", "bentlerQ", "geominQ", and "bifactorQ"). "orthogonal" and "oblique" select all rotations of that kind except the bifactor rotation, which looks for a different factor structure. Do not mix orthogonal and oblique rotations. Default is "promax".
- type
character vector. Any combination of "none" (default), "EFAtools", "psych", and "SPSS". "none" uses the settings from the arguments below. The other types use the settings of that implementation (see
efa_fit()). These differ for PAF, varimax, and promax only.- averaging
character. "mean" (default) or "median".
- trim
numeric. The fraction of solutions to remove from each end before the mean is calculated (see
base::mean()). Used only foraveraging = "mean". Default is 0.- salience_threshold
numeric. A loading with an absolute value of at least this threshold is salient. Default is 0.3. Unrotated loadings of more than one factor seldom have a simple structure, so for
rotation = "none", salience and admissibility are of little use.- max_iter
numeric. The maximum number of PAF iterations. Default is 10,000. A named
typeuses its own maximum (SPSS 25, psych 50, and EFAtools 300).- init_comm
character vector. Any combination of "smc", "mac", and "unity": the initial PAF communalities are the squared multiple correlations, the maximum absolute correlations, or 1. Default is all three.
- criterion
numeric vector. The PAF convergence criterion. Default is
0.001.- criterion_type
character vector. Any combination of "sum" and "max_individual": PAF converges when the change in the sum of the communalities, or the largest change in one communality, is less than
criterion. Default is both.- abs_eigen
logical vector. Any combination of TRUE and FALSE. If TRUE, PAF uses the absolute eigenvalues (as SPSS does); if FALSE, the eigenvalues (as
psych::fa()does). Default is TRUE.- varimax_type
character vector. Any combination of "svd" (as
stats::varimax()) and "kaiser" (as SPSS; Kaiser, 1958; Grieder & Steiner, 2022). Used for varimax and promax. Default is both.- normalize
logical vector. Any combination of TRUE and FALSE. If TRUE, a Kaiser normalization is done before the rotation. Default is TRUE.
- k_promax
numeric vector. The power for the promax target matrix. Default is
2:4.- k_simplimax
numeric vector. The number of near-zero loadings for simplimax: whole numbers from 1 to the number of loadings. Default is
ncol(x).- p_type
character vector. Any combination of "norm" and "unnorm": the promax target matrix with or without normalization (Hendrickson & White, 1964). Default is both.
- precision
numeric vector. The convergence tolerance of the rotation. Default is
1e-5.- start_method
character vector. Any combination of "psych" and "factanal": the ML starting values of
psych::fa()orstats::factanal(). Default is both.- use
character. Passed to
stats::cor()for raw data. Default is "pairwise.complete.obs". Not used forcor_method = "fiml".- cor_method
character. The correlation for raw data: "pearson" (default), "spearman", "kendall", "poly", "tetra", or "fiml" (see
efa_fit()and Details).- show_progress
logical. If TRUE (default), a progress bar is shown.
- seed
numeric or
NULL. A seed that makes the result reproducible, also with parallel workers (set a plan withfuture::plan()). Necessary only for criterion-based rotations, which use random starts. The random-number state of the session is restored afterwards. Default isNULL.- P_type
- se
Not used.
efa_average()gives no standard errors, so a value other thanNULL(default) is an error.
Value
A list of class efa_average with:
- orig_R
The correlation matrix.
- h2
The communalities.
- loadings
The loadings: unrotated for
rotation = "none", otherwise rotated (pattern coefficients).- Phi
The factor intercorrelations of oblique solutions, otherwise
NA.- ind_fac_corres
For each loading, the proportion of solutions in which it is salient. The row sums can be more than 1 because of cross-loadings.
- vars_accounted
The variances accounted for, with the rows "SS loadings", "Prop Tot Var", and, for more than one factor, "Prop Comm Var". From the rotated loadings, except for
rotation = "none"or one factor.- fit_indices
A data frame with one row for each fit index and for df.
- implementations_grid
A data frame with one row for each fit: its settings,
errorsanderror_m(the error message),converged(0 = converged; for ML and ULS the codes ofstats::optim(), for PAF 1 ifmax_iterwas reached),rot_converged(NAwithout a rotation),heywood,admissible, and the fit indices.- efa_list
The
efa_fit()objects (atry-errorobject for a fit that gave an error), with the row names ofimplementations_grid.- settings
The settings used, including
seed.
h2, loadings, Phi, and vars_accounted are lists with the elements
average, sd, min, max, and range; fit_indices has these as columns.
average is the (trimmed) mean or the median, and range is the difference
max - min.
If the arguments give only one model, efa_average() gives a warning and returns
that efa_fit() object. Its settings are the settings of that fit, with
type = "none" and order_type = "eigen".
Details
efa_average() makes a grid of all setting combinations that give different
models, fits each model with efa_fit(), and summarises the solutions. The
correlation matrix is calculated one time and used for all fits. The arguments
from max_iter to start_method apply only to type = "none", except
k_simplimax, which applies to all types. Each argument applies only to the
estimators and rotations that use it.
Before the solutions are averaged, the factors of each solution are matched in
order and sign to the first solution that is not excluded, by Tucker congruence.
For this reason, all fits use the eigenvalue-based factor order, also for a named
type. Thus, a fit in efa_list can show a different factor order than the same
fit from efa_fit().
A solution is excluded from the averaging if its fit gave an error, if the
estimation or the rotation did not converge, or if it has a Heywood case (a
communality of 1 or more, or an ML or ULS uniqueness at its lower bound). A
solution is admissible if it is not excluded and each factor has at least two
salient loadings. Solutions that are not admissible are averaged too. If all fits
give an error, efa_average() stops with the error message. If no solution is
left for other reasons, the summaries are NA.
Each loading, communality, factor intercorrelation, and fit index is summarised
separately across the solutions. Thus, the average, minimum, and maximum loading
matrices are not fitted solutions: they do not reproduce the correlation matrix.
Likewise, the fit indices are averages of the fit indices of the solutions, not
the fit of the averaged loadings. The averaged p_chi is descriptive only. Without
N, only CAF (Lorenzo-Seva, Timmerman, & Kiers, 2011), SRMR, and RMSR are
available.
With cor_method = "fiml", the EM algorithm estimates the saturated moments one
time, with the assumption that the data are missing at random. The chi-square and
the indices calculated from it are the ML or ULS statistics for this correlation
matrix, not the corrected two-stage statistics of efa_fit().
See also
Other factor analysis:
efa_fit(),
efa_group(),
efa_mi(),
plot.efa_group(),
print.efa_group()
Examples
# One implementation each of PAF, ULS, and ML, with promax (3 EFAs)
Aver_meth <- efa_average(test_models$baseline$cormat, n_factors = 3, N = 500,
estimator = c("PAF", "ULS", "ML"), type = "EFAtools",
start_method = "psych")
# \donttest{
# Different implementations of PAF and promax (72 EFAs)
Aver_PAF <- efa_average(test_models$baseline$cormat, n_factors = 3, N = 500)
# The median instead of the mean (72 EFAs)
Aver_PAF_md <- efa_average(test_models$baseline$cormat, n_factors = 3, N = 500,
averaging = "median")
# Different implementations of PAF and promax, and ULS and different
# versions of ML (108 EFAs)
Aver_meth_ext <- efa_average(test_models$baseline$cormat, n_factors = 3, N = 500,
estimator = c("PAF", "ULS", "ML"))
# Different oblique rotations with one implementation of ML (6 EFAs)
Aver_rot <- efa_average(test_models$baseline$cormat, n_factors = 3, N = 500,
estimator = "ML", rotation = "oblique", type = "EFAtools",
start_method = "psych")
# }
# \donttest{
# Two-stage FIML correlations from raw data with missing values
x_miss <- GRiPS_raw
x_miss[cbind(1:20, 1)] <- NA
Aver_fiml <- efa_average(x_miss, n_factors = 1, estimator = c("PAF", "ML"),
cor_method = "fiml")
# }