auxiliary {semTools}R Documentation

Implement Saturated Correlates with FIML

Description

Automatically add auxiliary variables to a lavaan model when using full information maximum likelihood (FIML) to handle missing data

Usage

auxiliary(model, data, aux, fun, ...)

lavaan.auxiliary(model, data, aux, ...)

cfa.auxiliary(model, data, aux, ...)

sem.auxiliary(model, data, aux, ...)

growth.auxiliary(model, data, aux, ...)

Arguments

model

The analysis model can be specified with 1 of 2 objects:

  1. lavaan model.syntax specifying a hypothesized model without mention of auxiliary variables in aux

  2. a parameter table, as returned by parTable, specifying the target model without auxiliary variables. This option requires these columns (and silently ignores all others): c("lhs","op","rhs","user","group","free","label","plabel","start")

data

data.frame that includes auxiliary variables as well as any observed variables in the model

aux

character. Names of auxiliary variables to add to model

fun

character. Name of a specific lavaan function used to fit model to data (i.e., "lavaan", "cfa", "sem", or "growth"). Only required for auxiliary.

...

additional arguments to pass to lavaan.

Details

These functions are wrappers around the corresponding lavaan functions. You can use them the same way you use lavaan, but you must pass your full data.frame to the data argument. Because the saturated-correlates approaches (Enders, 2008) treates exogenous variables as random, fixed.x must be set to FALSE. Because FIML requires continuous data (although nonnormality corrections can still be requested), no variables in the model nor auxiliary variables specified in aux can be declared as ordered.

Value

a fitted lavaan object. Additional information is stored as a list in the @external slot:

Author(s)

Terrence D. Jorgensen (University of Amsterdam; TJorgensen314@gmail.com)

References

Enders, C. K. (2008). A note on the use of missing auxiliary variables in full information maximum likelihood-based structural equation models. Structural Equation Modeling, 15(3), 434–448. doi:10.1080/10705510802154307

Examples

dat1 <- lavaan::HolzingerSwineford1939
set.seed(12345)
dat1$z <- rnorm(nrow(dat1))
dat1$x5 <- ifelse(dat1$z < quantile(dat1$z, .3), NA, dat1$x5)
dat1$x9 <- ifelse(dat1$z > quantile(dat1$z, .8), NA, dat1$x9)

targetModel <- "
  visual  =~ x1 + x2 + x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
"

## works just like cfa(), but with an extra "aux" argument
fitaux1 <- cfa.auxiliary(targetModel, data = dat1, aux = "z",
                         missing = "fiml", estimator = "mlr")

## with multiple auxiliary variables and multiple groups
fitaux2 <- cfa.auxiliary(targetModel, data = dat1, aux = c("z","ageyr","grade"),
                         group = "school", group.equal = "loadings")

## calculate correct incremental fit indices (e.g., CFI, TLI)
fitMeasures(fitaux2, fit.measures = c("cfi","tli"))
## NOTE: lavaan will use the internally stored baseline model, which
##       is the independence model plus saturated auxiliary parameters
lavInspect(fitaux2@external$baseline.model, "free")


[Package semTools version 0.5-6 Index]