Dear colleagues,
Lavaan (06.-3)
yielded different results when using the FIML estimator compared to applying multiple
imputation with the mice package in lavaan directly to take care of the missing
data. The results strongly differ, i.e., significant predictors (p < .001) with
FIML are largely irrelevant using MI (p = .220). I assumed that I would get roughly
similar results when using the same set of variables and auxiliary variables in
both estimations. So I was wondering what might cause the differences.
Here is what I did: The aim was to analyze the relationship between a set of 12 belief variables and attitudes in two ways. First, I specified a belief LV and regressed it on attitudes to determine the influence of the total set of beliefs on attitudes. Second, I intended to identify significant predictors of attitudes by using multiple indicators multiple causes (MIMIC) model as mentioned by Kline (2016).
For measuring the belief items, I used an expectancy-value approach. I tried two ways to deal with the expectancy value model, that is, (1) calculating expectancy-value products (evp) prior to the data analysis and include them as manifest indicators; (2) specifying interactions between expectancy-items (bb) and value-items (oe) in the model syntax.
The design
is a planned missingness design (three form design), and missing data (approx.
33%) is in the beliefs only. N = 355; MLR estimator is used to accounting for
the nonnormal distribution of scores (I am aware that MI requires multivariate
normality!).
# model syntax for beliefs as LV and evp calculated prior to analysis
model <- '
AB.B =~ 1*ab3 + ab1 + ab5 + ab6 #first attitudinal factor
AB.N =~ 1*ab7 + ab4 + ab2 #second attitudinal factor
BB.scale =~ evp1 + evp2 + evp3 + evp4 + evp5 + evp6 + evp7 + evp8 + evp9 + evp10 + evp11 + evp12
AB.B + AB.N ~ BB.scale
'
#model syntax for beliefs as LV and evp calculated as interactions of bb and oe
model <- '
AB.B =~ 1*ab3 + ab1 + ab5 + ab6
AB.N =~ 1*ab7 + ab4 + ab2
BB =~ bb1 + bb2 + bb3 + bb4 + bb5 + bb6 + bb7 + bb8 + bb9 + bb10 + bb11 + bb12
OE =~ oe1 + oe2 + oe3 + oe4 + oe5 + oe6 + oe7 + oe8 + oe9 + oe10 + oe11 + oe12
EVP =~ bb1:oe1 + bb2:oe2 + bb3:oe3 + bb4:oe4 + bb5:oe5 + bb6:oe6: + bb7:oe7 + bb8:oe8 + bb9:oe9 + bb10:oe10 + bb11:oe11 + bb12:oe12
AB.B + AB.N ~ EVP
'
#model syntax for MIMIC model
model <- '
AB.B =~ 1*ab3 + ab1 + ab5 + ab6
AB.N =~ 1*ab7 + ab4 + ab2
AB.B + AB.N
~ evp1 + evp2 + evp3 + evp4 + evp5 + evp6 + evp7 + evp8 + evp9 + evp10 + evp11
+ evp12
'
# fit measures in lavaan using FIML
fit <- lavaan::sem(model, data = data, estimator = "mlr", missing = "fiml.x")
summary(fit, fit.measures = TRUE, ci = TRUE, standardized = TRUE, rsquare = TRUE, modindices = TRUE)
#fit measures in lavaan using the mice package
dataframe <- dplyr::select(data, ab1, ab2, ab3, ab4, ab5, ab6, ab7, ab8, bb1, bb2, bb3, bb4, bb5, bb6, bb7, bb8, bb9, bb10, bb11, bb12, oe1, oe2, oe3, oe4, oe5, oe6, oe7, oe8, oe9, oe10, oe11, oe12, evpbb1, evpbb2, evpbb3, evpbb4, evpbb5, evpbb6, evpbb7, evpbb8, evpbb9,evpbb10, evpbb11, evpbb12)
out <- sem.mi(model,
data = dataframe,
m = 30,
seed = 21309,
miPackage = "mice",
fun = "lavaan", "std.lv")
summary(out, ci = TRUE, asymptotic = TRUE, add.attributes = TRUE, stand = TRUE, rsq = TRUE)
I greatly appreciate your thoughts and comments, and how you would move forward. Do you think that FIML is the better way to account for missing data in my case?
Thanks,
Benedikt
PS: Using the runMI() function for MI, I get the error message, that the initial model-implied matrix (Sigma) is not positive definite; I also found that using missing = “fiml.x” does not properly works in the MIMIC model as missing = “pairwise” leads to the same results. Is there any alternative to account for missing data in a MIMIC model?
have tried to use the mitml package without success.
?mids2mitml.list
?within.mitml.list
What I am now running into is getting an error: "Error in data[, var1] : incorrect number of dimensions" that I just can't seem to resolve. The code I am using is:impmitml <- mids2mitml.list(impute.sem)
mice.imp.interact <- within(impmitml, {interaction <- indProd(impmitml, var1=6:8, var2=5, match = FALSE, meanC = TRUE, residualC = FALSE, doubleMC = TRUE, namesProd = NULL)})
indProd() returns a data.frame already, so don't use within(), use with(). And don't assign it to anything.
mice.imp.interact <- with(impmitml, {indProd(impmitml, var1=6:8, var2=5, match = FALSE, meanC = TRUE, residualC = FALSE, doubleMC = TRUE, namesProd = NULL)})
Terrence D. JorgensenAssistant Professor, Methods and StatisticsResearch Institute for Child Development and Education, the University of Amsterdam
--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/XpwzUh4h3gs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/a1019f4b-9c5d-4306-81c1-22a9a3ee7ba5%40googlegroups.com.
I am still running into the same error as I was before: "Error in data[, var1] : incorrect number of dimensions".
HSMiss <- HolzingerSwineford1939[ , c(paste("x", 1:9, sep = ""),
"ageyr","agemo","school")]
set.seed(12345)
HSMiss$x5 <- ifelse(HSMiss$x5 <= quantile(HSMiss$x5, .3), NA, HSMiss$x5)
age <- HSMiss$ageyr + HSMiss$agemo/12
HSMiss$x9 <- ifelse(age <= quantile(age, .3), NA, HSMiss$x9)
library(Amelia)
set.seed(12345)
HS.amelia <- amelia(HSMiss, m = 3, noms = "school", p2s = FALSE)
imps <- HS.amelia$imputations
imps <- lapply(imps, indProd,
var1 = c("x1","x2","x3"), var2 = c("x4","x5","x6"))
## specify CFA model from lavaan's ?cfa help page
HS.model <- '
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
VT =~ x1.x4 + x2.x5 + x3.x6
speed =~ x7 + x8 + x9
speed ~ visual + textual + VT
'
out <- cfa.mi(HS.model, data = imps, std.lv = TRUE)
summary(out)
impmitml <- lapply(impmitml, indProd,
var1=6:8, var2=5, match = FALSE)
devtools::install_github("simsem/semTools/semTools")