Description Usage Arguments Details Value Author(s) References Examples
Automatically add auxiliary variables to a lavaan model when using full information maximum likelihood (FIML) to handle missing data
1 2 3 4 5 6 7 8 9  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, ...)

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

data 

aux 

fun 

... 
additional arguments to pass to 
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 saturatedcorrelates 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
.
a fitted lavaan
object. Additional
information is stored as a list
in the @external
slot:
baseline.model
. a fitted lavaan
object. Results of fitting an appropriate independence model for
the calculation of incremental fit indices (e.g., CFI, TLI) in
which the auxiliary variables remain saturated, so only the target
variables are constrained to be orthogonal. See Examples for how
to send this baseline model to fitMeasures
.
aux
. The character vector of auxiliary variable names.
baseline.syntax
. A character vector generated within the
auxiliary
function, specifying the baseline.model
syntax.
Terrence D. Jorgensen (University of Amsterdam; TJorgensen314@gmail.com)
Enders, C. K. (2008). A note on the use of missing auxiliary variables in full information maximum likelihoodbased structural equation models. Structural Equation Modeling, 15(3), 434–448. doi: 10.1080/10705510802154307
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  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")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.