1

I am running some multi-group confirmatory factor analyses (CFA) in lavaan in R after multiple imputation.

First, I created a list called Plav to store 5 imputed datasets:

library(lavaan)
library(lavaan.survey)
library(mitools)
library(semTools)

a <- imputationList(Plav) ##Tell R these are plausible values
Survey <- svydesign(ids = ~1, weights = ~wt, data = a) # set the weight

Subsequently, I conducted a multi-group CFA:

# Model without population corrections
fit <- cfa(model, data=Plav[[1]], estimator = 'MLR', missing = 'default', group = 'gender',group.equal = c("loadings"))
# Model with population corrections
fitSurvey <- lavaan.survey(lavaan.fit = fit, survey.design =  Survey)

The following error was returned:

Error in FUN(X[[1L]], ...) : 
  dims [product 1936] do not match the length of object [0]

When I remove the grouping variable and conduct an analysis on the whole sample, no error is returned.

Can anybody explain why this error is returned?

L. Bakker
  • 147
  • 1
  • 13
user2702330
  • 311
  • 3
  • 10
  • I'm not familiar with the imputation package you are trying to use. Are you committed to using it? Because I believe `lavaan` has ways to incorporate `mice`-based multiple imputation pretty easily. In other words, are you looking for an explanation for your particular error, or are you more concerned about figuring out a way to use MI in your multi-group model. – jsakaluk Apr 02 '15 at 05:00
  • I am more concerned about weights in MI. When I use `Survey <- svydesign(ids = ~1, weights = ~wt, data = Plav[[1]])`, the model works well. – user2702330 Apr 02 '15 at 05:34
  • i'm not sure anyone will be able to help you until you provide a reproducible example. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Anthony Damico Apr 14 '15 at 07:31

0 Answers0