Hi all,
this is my first post and I hope this is the right place for my problem. I want to estimate a structural equation model with multiply imputed data using lavaan.mi() from the semTools package. The data were previously imputed with the mice package, so I extracted the five imputed data sets with:
imputed<-list()
for(i in 1:5) {
imputed[[i]] <- complete(imp, i)
}
Then I tried to fit the model:
sem.m3.fit<-lavaan.mi(sem.m3, data=imputed, chi="all", likelihood="wishart", int.ov.free=T,
int.lv.free=F, auto.fix.first=T, auto.fix.single=T, auto.var=T, auto.cov.lv.x=F, auto.cov.y=F,
auto.th=T, auto.delta=T)
This leaves me with an error message:
Error in `[<-`(`*tmp*`, rhs, lhs, value = 1) : subscript out of bounds
However, when I fit the model with just one of the imputed data sets,
sem.m3.fit<-lavaan(sem.m3, data=imputed[[1]], likelihood="wishart", int.ov.free=T,
int.lv.free=F, auto.fix.first=T, auto.fix.single=T, auto.var=T, auto.cov.lv.x=F, auto.cov.y=F,
auto.th=T, auto.delta=T)
the model is fitted without any error. I varied the arguments in lavaan.mi() that are passed to lavaan() and tried sem.mi() as an alternative - to no avail. Therefore, if I didn't make a mistake, I suspect the problem might be in lavaan.mi() [or the function it wraps, runMI()] rather than lavaan(). Still, as Yves Rosseel also contributes to the semTools package, I suspected this might be the right place to ask for help. So: Can anybody help me out? Thanks in advance.
Christian