Computes a set of diagnostics describing how suitable a correlation matrix (or raw data) is for exploratory factor analysis: the Kaiser-Meyer-Olkin (KMO) measure of sampling adequacy overall and per variable, Bartlett's test of sphericity, the determinant and condition number of the correlation matrix, and the squared multiple correlation (SMC) of each variable with all the others.
efa_screen(
x,
N = NA,
use = c("pairwise.complete.obs", "all.obs", "complete.obs", "everything",
"na.or.complete"),
cor_method = c("pearson", "spearman", "kendall", "poly", "tetra"),
mcd_alpha = 0.5,
outlier_cutoff = 0.975,
seed = NULL
)An object of class efa_screen, a list containing:
A list with the overall KMO (KMO) and the per-variable KMO
(KMO_i).
A list with Bartlett's chi-square statistic (chisq), its
p_value, and its degrees of freedom (df); chisq and p_value are NA
when N is too small for the Bartlett correction. NULL when N is
unavailable.
The determinant of the correlation matrix.
The condition number of the correlation matrix (largest over smallest eigenvalue).
The per-variable squared multiple correlations.
A data frame with one row per variable (row names are the
variable names) holding the per-item diagnostics: variance (over the
available values), missing (percentage of missing values), smc, kmo_i,
and flags (a comma-separated list of any sparse/empty-category issues, the
empty string "" for a categorical variable with none, and NA for a variable
treated as continuous). NULL when a correlation matrix is supplied.
Multivariate-normality diagnostics computed from the complete cases
of the raw data: a list with mardia (Mardia's multivariate skewness statistic
skewness, its degrees of freedom skewness_df and p-value skewness_p, a
small_sample flag recording whether the small-sample skewness correction was
applied, the standardised kurtosis statistic and its p-value kurtosis_p, and the
underlying coefficients b1p and b2p), hz (the Henze-Zirkler statistic and its
p_value), and n_complete (the number of complete cases used). When the
complete-case covariance is singular the tests are skipped and a classed note (of
class efa_screen_no_mvn) is returned instead, alongside a warning. NULL when a
correlation matrix is supplied.
Multivariate-outlier diagnostics from the complete cases of the raw
data: a list with distances (each complete case's robust Mahalanobis distance, named
by its row number in the supplied data), cutoff (the flagging threshold on the
distance scale, sqrt(qchisq(outlier_cutoff, p)), directly comparable to distances),
flagged (the row numbers, in the supplied data, whose robust distance exceeds
cutoff), center and cov (the robust location and scatter underlying the
distances), method ("mcd" for the robust estimate, or "classical" when the
fallback was used), and n_complete (the number of complete cases). When neither a
robust nor a classical covariance can be formed a classed note (of class
efa_screen_no_outliers) is returned instead. NULL when a correlation matrix is
supplied.
A named list with, for each variable treated as categorical,
the response-category counts (in category order); NA for a variable treated
as continuous. NULL when a correlation matrix is supplied.
A classed note explaining that the raw-data diagnostics need raw
data; NULL when raw data are supplied.
A list of the settings used, including n_obs, the number of
rows in the supplied raw data (NA for a correlation-matrix input).
data.frame or matrix. Data frame or matrix of raw data, or a matrix of correlations.
numeric. The number of observations. Only needs to be specified when a
correlation matrix is supplied; it is required for Bartlett's test of
sphericity and is taken from the data when raw data are supplied. Default is
NA.
character. Passed to stats::cor() if raw data are supplied. Default
is "pairwise.complete.obs".
character. Correlation computed from raw data: "pearson",
"spearman", or "kendall" (passed to stats::cor()), or "poly" /
"tetra" for polychoric / tetrachoric correlations of ordinal / binary data
(a two-step estimator with no empty-cell continuity correction). Default is
"pearson".
numeric. The proportion of observations covered by the minimum
covariance determinant (MCD) subset used for the robust outlier diagnostics, in
[0.5, 1]. The default, 0.5, gives the most robust (highest-breakdown) estimate;
larger values trade robustness for efficiency. Only used when raw data are supplied.
numeric. The probability defining the chi-square cutoff for
flagging a multivariate outlier: an observation is flagged when its squared robust
distance exceeds qchisq(outlier_cutoff, p) for p variables. Default is 0.975.
Only used when raw data are supplied.
integer. Optional seed for the random subsets drawn by the MCD algorithm,
making the outlier diagnostics reproducible; the caller's random-number-generator
state is left unchanged. Default is NULL. Only used when raw data are supplied.
The diagnostics are computed from the analysis correlation matrix \(R\):
The Kaiser-Meyer-Olkin measure of sampling adequacy (Kaiser, 1970;
Kaiser & Rice, 1974), overall and for each variable. Larger values (a rough
floor of .50) indicate greater suitability for factor analysis; see KMO().
Bartlett's (1951) test of sphericity, the likelihood-ratio
test of the hypothesis that \(R\) is an identity matrix, with
\(df = p(p - 1)/2\) for \(p\) variables. It requires the sample size
N; when N is unavailable (a correlation matrix supplied without N) the
test is skipped with a warning, $bartlett is NULL, and the remaining
diagnostics are still returned. See BARTLETT().
The determinant of \(R\). A value near zero signals extreme multicollinearity or a (near-)singular matrix; as a rough guide, a determinant below about 0.00001 is commonly taken as a sign of multicollinearity (Field, 2018).
The ratio of the largest to the smallest eigenvalue of \(R\). Large values indicate an ill-conditioned matrix with near-linear dependencies among the variables. Its square root is the condition index: an index above 30 is a conventional sign of strong multicollinearity, and 10 to 30 of moderate multicollinearity (Belsley, Kuh & Welsch, 1980).
The squared multiple correlation of each variable with all the others, \(1 - 1/(R^{-1})_{ii}\). A low SMC flags a variable that shares little variance with the rest of the set.
The variance of each variable (over its
available values) and the percentage of missing values. These, and the
category tabulation below, are computed column by column from the supplied
data using every non-missing value, and so do not depend on use, which
governs only the correlation matrix. Under a listwise use
("complete.obs" / "na.or.complete") the correlation matrix and N are
based on the complete cases, while the missingness is reported over every
supplied row so that it explains why N is smaller; the number of supplied
rows is recorded in settings$n_obs. Available only from raw data.
For each variable with fewer than ten distinct values (treated as categorical), the response-category counts, flagging a sparse category (fewer than five responses) and, for integer-coded variables, an empty interior category (an unused category between the smallest and largest observed value). A variable with ten or more distinct values is treated as continuous and is not tabulated. As a rough guide, items with fewer than five response categories are better analysed with an ordinal estimator (polychoric correlations with categorical least squares) than with normal-theory maximum likelihood (Rhemtulla et al., 2012). Available only from raw data.
Two tests of multivariate normality computed from the complete cases of the raw data: Mardia's (1970) multivariate skewness and kurtosis, and the Henze-Zirkler (1990) omnibus test. A small p-value indicates a departure from multivariate normality, a reason to prefer robust or ordinal estimation over normal-theory maximum likelihood. Available only from raw data, and skipped with a note if the complete-case covariance is singular.
Multivariate outliers flagged by their robust Mahalanobis
distance. A high-breakdown robust location and scatter are estimated from the
complete cases with the fast minimum covariance determinant (MCD) algorithm
(Rousseeuw & Van Driessen, 1999), using a subset covering a proportion
mcd_alpha of the observations; an observation whose squared robust distance
exceeds qchisq(outlier_cutoff, p) is flagged. With too few complete cases
(\(n \le 2p\)) or collinear variables the robust covariance is undefined, so
the classical Mahalanobis distance is used instead with a warning; if even that
covariance is singular the diagnostic is skipped with a note. Available only
from raw data.
KMO() and BARTLETT() for the individual suitability measures, and
N_FACTORS() for factor retention criteria.
Other factor analysis suitability:
print.efa_screen()
# From a correlation matrix (supply N for Bartlett's test of sphericity)
efa_screen(test_models$baseline$cormat, N = 500)
# From raw data (N is taken from the data)
efa_screen(GRiPS_raw)
Run the code above in your browser using DataLab