Learn R Programming

umx (version 1.7.5)

umxEFA: umxEFA

Description

Perform full-information maximum-likelihood factor analysis on a data matrix. as in factanal, you need only specify the number of factors and offer up some manifest data, e.g:

umxEFA(factors = 2, data = mtcars)

Usage

umxEFA(x = NULL, factors = NULL, data = NULL, covmat = NULL,
  n.obs = NULL, scores = c("none", "ML", "WeightedML", "Regression"),
  rotation = c("varimax", "promax", "none"), name = "efa", digits = 2,
  report = c("1", "table", "html"))

Arguments

x

Either 1: data, 2: A formula (not implemented yet), 3: A collection of variable names, or 4: A name for the model.

factors

Either number of factors to request or a vector of factor names.

data

A dataframe of manifest columns you are modeling

covmat

Covariance matrix of data you are modeling (not implemented)

n.obs

Number of observations in covmat (if provided, default = NA)

scores

Type of scores to produce, if any. The default is none, "Regression" gives Thompson's scores. Other options are 'ML', 'WeightedML', Partial matching allows these names to be abbreviated.

rotation

A rotation to perform on the loadings (default = "varimax" (orthogonal))

name

A name for your model

digits

rounding (default = 2)

report

What to report

Value

- EFA mxModel

Details

Equivalently, you can also give a list of factor names:

umxEFA(factors = c("g", "v"), data = mtcars)

notes: In an EFA, all items may load on all factors. For identification we need m^2 degrees of freedom. We get m * (m+1)/2 from fixing factor variances to 1 and covariances to 0. We get another m(m-1)/2 degrees of freemdom by fixing the upper-right hand corner of the factor loadings component of the A matrix. The manifest variances are also lbounded at 0.

EFA reports standardized loadings: to do this, we scale the data.

Bear in mind that factor scores are indeterminate and can be rotated.

This is very much early days. Adding "scores" in response to demand.

todo: detect ordinal items and switch to UWLS

References

- http://github.com/tbates/umx

See Also

- factanal, mxFactorScores

Other Super-easy helpers: umxTwoStage, umx

Examples

Run this code
# NOT RUN {
myVars <- c("mpg", "disp", "hp", "wt", "qsec")
m1 = umxEFA(mtcars[, myVars], factors =   2, rotation = "promax")
loadings(m1)
m2 = factanal(~ mpg + disp + hp + wt + qsec, factors = 2, rotation = "promax", data = mtcars)
loadings(m2)
# }
# NOT RUN {
plot(m2)
m1 = umxEFA(myVars, factors = 2, data = mtcars, rotation = "promax")
m1 = umxEFA(name = "named", factors = "g", data = mtcars[, myVars])
m1 = umxEFA(name = "by_number", factors = 2, rotation = "promax", data = mtcars[, myVars])
m1 = umxEFA(name = "score", factors = "g", data = mtcars[, myVars], scores= "Regression")
# }

Run the code above in your browser using DataLab