| twostage {semTools} | R Documentation |
This function automates 2-Stage Maximum Likelihood (TSML) estimation, optionally with auxiliary variables. Step 1 involves fitting a saturated model to the partially observed data set (to variables in the hypothesized model as well as auxiliary variables related to missingness). Step 2 involves fitting the hypothesized model to the model-implied means and covariance matrix (also called the "EM" means and covariance matrix) as if they were complete data. Step 3 involves correcting the Step-2 standard errors (SEs) and chi-squared statistic to account for additional uncertainty due to missing data (using information from Step 1; see References section for sources with formulas).
All variables (including auxiliary variables) are treated as endogenous varaibles in the Step-1 saturated model (fixed.x = FALSE), so data are assumed continuous, although not necessarily multivariate normal (dummy-coded auxiliary variables may be included in Step 1, but categorical endogenous variables in the Step-2 hypothesized model are not allowed). To avoid assuming multivariate normality, request se = "robust.huber.white". CAUTION: In addition to setting fixed.x = FALSE and conditional.x = FALSE in lavaan, this function will automatically set meanstructure = TRUE, estimator = "ML", missing = "fiml", and test = "standard". lavaan's se option can only be set to "standard" to assume multivariate normality or to "robust.huber.white" to relax that assumption.
twostage(..., aux, fun, baseline.model = NULL) cfa.2stage(..., aux = NULL, baseline.model = NULL) sem.2stage(..., aux = NULL, baseline.model = NULL) growth.2stage(..., aux = NULL, baseline.model = NULL) lavaan.2stage(..., aux = NULL, baseline.model = NULL)
... |
Arguments passed to the |
aux |
An optional character vector naming auxiliary variable(s) in |
fun |
The character string naming the lavaan function used to fit the Step-2 hypothesized model ( |
baseline.model |
An optional character string, specifying the lavaan |
The twostage object contains 3 fitted lavaan models (saturated, target/hypothesized, and baseline) as well as the names of auxiliary variables. None of the individual models provide the correct model results (except the point estimates in the target model are unbiased). Use the methods in twostage to extract corrected SEs and test statistics.
Terrence D. Jorgensen (University of Amsterdam; TJorgensen314@gmail.com)
Savalei, V., \& Bentler, P. M. (2009). A two-stage approach to missing data: Theory and application to auxiliary variables. Structural Equation Modeling, 16(3), 477-497. doi:10.1080/10705510903008238
Savalei, V., \& Falk, C. F. (2014). Robust two-stage approach outperforms robust full information maximum likelihood with incomplete nonnormal data. Structural Equation Modeling, 21(2), 280-302. doi:10.1080/10705511.2014.882692
## set some example data missing at random
dat1 <- HolzingerSwineford1939
dat1$x5 <- ifelse(dat1$x1 <= quantile(dat1$x1, .3), NA, dat1$x5)
dat1$age <- dat1$ageyr + dat1$agemo/12
dat1$x9 <- ifelse(dat1$age <= quantile(dat1$age, .3), NA, dat1$x9)
## fit CFA model from lavaan's ?cfa help page
model <- '
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
'
## use ageyr and agemo as auxiliary variables
out <- cfa.2stage(model = model, data = dat1, aux = c("ageyr","agemo"))
## two versions of a corrected chi-squared test results are shown
out
## see Savalei & Bentler (2009) and Savalei & Falk (2014) for details
## the summary additionally provides the parameter estimates with corrected
## standard errors, test statistics, and confidence intervals, along with
## any other options that can be passed to parameterEstimates()
summary(out, standardized = TRUE)
## use parameter labels to fit a more constrained model
modc <- '
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + a*x8 + a*x9
'
outc <- cfa.2stage(model = modc, data = dat1, aux = c("ageyr","agemo"))
## use the anova() method to test this constraint
anova(out, outc)
## like for a single model, two corrected statistics are provided