| efa | R Documentation |
Fit one or more Exploratory Factor Analysis (EFA) model(s).
efa(data = NULL, nfactors = 1L, sample_cov = NULL, sample_nobs = NULL,
rotation = "geomin", rotation_args = list(), ov_names = NULL,
bounds = "pos.var", ..., output = "efa")
data |
A data frame containing the observed variables we need for the
EFA. If only a subset of the observed variables is needed, use the
|
nfactors |
Integer, integer vector, or a list. The desired number of
factors to extract. Can be a single number, or a vector of numbers
(e.g., |
sample_cov |
Numeric matrix. A sample variance-covariance matrix. The rownames and/or colnames must contain the observed variable names. Unlike sem and CFA, the matrix may be a correlation matrix. |
sample_nobs |
Number of observations if the full data frame is missing and only the sample variance-covariance matrix is given. |
rotation |
Character or a list with first element a character variable.
The character variable is the rotation method to be used. Possible options
are varimax, quartimax, orthomax, oblimin, quartimin, geomin, promax,
entropy, mccammon, infomax, tandem1, tandem2, oblimax, bentler, simplimax,
target.strict, target (alias for pst), pst (=partially specified target),
cf, crawford-ferguson,
cf-quartimax, cf-varimax, cf-equamax,
cf-parsimax, cf-facparsim, biquartimin, bigeomin. The latter two are
for bifactor rotation only. The rotation algorithms (except promax
and target) are similar to those from the GPArotation package, but have
been reimplemented for better control. The promax method is taken from the
stats package. The target.strict method is equal to the target method in
the GPArotation package. The target method is in fact the pst method where
all non-zero elements (in the target matrix) are ignored.
Options for the rotation algorithm can be provided in the list after the method.
The default options (and their alternatives) are For the target rotation methods ( |
rotation_args |
List. Options related to the rotation algorithm. DEPRECATED.
The options should now be given in the |
ov_names |
Character vector. The variables names that are needed for the EFA. Should be a subset of the variables names in the data.frame. By default (if NULL), all the variables in the data are used. |
bounds |
Per default, |
... |
Additional options to be passed to lavaan, using 'name = value'.
See |
output |
Character. If |
The efa function is essentially a wrapper around the
lavaan function. It generates the model syntax (for a given number
of factors) and then calls lavaan() treating the factors (in each
block) as a set that should be rotated. Each block is rotated
independently. Categorical data is handled as usual by first computing
an appropriate (e.g., tetrachoric or polychoric) correlation matrix,
which is then used as input for the EFA.
Multiple groups (via the group= argument) and twolevel data
(via the cluster= argument) are supported, and these may be
combined. By default, the same number of factors is extracted in every
block, but a different number of factors per block can be requested by
supplying nfactors as a list (see the nfactors argument).
The promax rotation method (taken from the stats package) is only
provided for convenience. Because promax is a two-step algorithm (first
varimax, then oblique rotation to get simple structure), it does not
use the gpa or pairwise rotation algorithms, and as a result, no
standard errors are provided.
If output = "lavaan", an object of class
lavaan. If output = "efa",
a list of class efaList for which a print(),
summary() and fitMeasures() method are available. Because
we added the (standardized) loadings as an extra element, the loadings
function (which is not a generic function) from the stats package will
also work on efaList objects.
lav_efalist_summary for a summary method if the output is
of class efaList.
## The famous Holzinger and Swineford (1939) example
fit <- efa(data = HolzingerSwineford1939,
ov.names = paste("x", 1:9, sep = ""),
nfactors = 1:3,
rotation = list("geomin", geomin_epsilon = 0.01, rstarts = 1))
summary(fit, nd = 3L, cutoff = 0.2, dot.cutoff = 0.05)
fitMeasures(fit, fit_measures = "all")
# target rotation
target <- matrix(0, 9, 3)
target[1:3, 1] <- 1
target[4:6, 2] <- 1
target[7:9, 3] <- 1
fit2 <- efa(data = HolzingerSwineford1939,
ov.names = paste("x", 1:9, sep = ""),
nfactors = 3,
rotation = list("target", target = target))
summary(fit2)
## Not run:
# twolevel EFA with a different number of factors per level:
# one factor at the within level, two factors at the between level
fit3 <- efa(data = Demo.twolevel, ov.names = paste0("y", 1:6),
cluster = "cluster", nfactors = list(c(1, 2)))
summary(fit3)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.