Hi all,
I got a data frame with n=88 and want to run a CFA using the lavaan package. The model I have specified requires 16 parameters to be estimated.
I am using the mice package to create a list of 5 imputed datasets.
When reading the lavaan documentation one is advised to use the semtools package to fit a model across several datasets.
The code I am running looks like this:
# run MI
imp <- mice(data)
# create a list of the datasets generated in mice
imputed_data_list <- lapply(1:5, function(i) complete(imp, i))
# run CFA on each dataset
output <- cfa.mi(model, data = imputed_data_list)
# get pooled results
summary(output)
When I run the last line of code to get the pooled estimates I get the following error:
"Error in if (categorical.flag) { : argument is of length zero"
How have others run CFA on imputed datasets? I have been consulting the van Buuren & Groothius-Oudshoorn (2011) but not found much on how to handle imputed datasets for CFA.
Best regards
Adam