Learn R Programming

lavaan (version 0.6-16)

efa: Exploratory Factor Analysis

Description

Fit one or more Exploratory Factor Analysis (EFA) model(s).

Usage

efa(data = NULL, nfactors = 1L, sample.cov = NULL, sample.nobs = NULL,
    rotation = "geomin", rotation.args = list(), ov.names = names(data),
    bounds = "pos.var", ..., output = "efa")

Value

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.

Arguments

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 ov.names argument.

nfactors

Integer or Integer vector. The desired number of factors to extract. Can be a single number, or a vector of numbers (e.g., nfactors = 1:4.), For each different number, a model is fitted.

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. 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, 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) are similar to those from the GPArotation package, but have been reimplemented for better control. The promax method is taken from the stats package.

rotation.args

List. Options related to the rotation algorithm. The default options (and their alternatives) are orthogonal = FALSE, row.weights = "default" (or "kaiser", "cureton.mulaik" or "none"), std.ov = TRUE, algorithm = "gpa" (or "pairwise"), rstarts = 30, gpa.tol = 1e-05, tol = 1e-08, max.iter = 10000L, warn = FALSE, verbose = FALSE, reflect = TRUE, order.lv.by = "index" (or "sumofsquares" or "none"). Other options are specific for a particular rotation criterion: geomin.epsilon = 0.001, orthomax.gamma = 1, promax.kappa = 4, cf.gamma = 0, and oblimin.gamma = 0.

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, all the variables in the data are used.

bounds

Per default, bounds = "pos.var" forces all variances of both observed and latent variables to be strictly nonnegative. See the entry in lavOptions for more options.

...

Aditional options to be passed to lavaan, using 'name = value'. See lavOptions for a complete list.

output

Character. If "efa" (the default), the output mimics the typical output of an EFA. If "lavaan", a lavaan object returned. The latter is only possible if nfactors contains a single (integer) number.

Details

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 as a single block that should be rotated. The function only supports a single group. 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. There is also (limited) support for twolevel data. The same number of factors is then extracted at the within and the between level. 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.

See Also

summary.efaList for a summary method if the output is of class efaList.

Examples

Run this code
## The famous Holzinger and Swineford (1939) example
fit <- efa(data = HolzingerSwineford1939, 
           ov.names = paste("x", 1:9, sep = ""),
           nfactors = 1:3,
           rotation = "geomin",
           rotation.args = list(geomin.epsilon = 0.01, rstarts = 1))
summary(fit, nd = 3L, cutoff = 0.2, dot.cutoff = 0.05)
fitMeasures(fit, fit.measures = "all")

Run the code above in your browser using DataLab