I'm having difficulty 'pooling' multilevel regression results using data that has been multiply imputed using MICE software through the R2MLwiN package (I'm a little stuck!).
What I am trying to do
Run 10 imputed datasets through the runMLwiN() function, and apply survey weights at level 1.
This is the code I am using
Code: Select all
Formula: F1 <- Y ~ 1 + x1 + x2 + (1|level2) + (1|level1)
model <- with(imputed, runMLwin(Formula = F1, estoptions=list(weighting=list(weightvar=c(NA, "Level1weight")), standardised=TRUE))
Error in eval(predvars, data, env) : object 'Level1weight' not found <---- NOT WORKING
If I do this:
model <model <- with(imputed, runMLwin(Formula = F1, estoptions=list(weighting=list(weightvar=c(NA, "Level1weight")), standardised=TRUE), data=imputed_as_dataframe) <-- WORKS but, treats the imputed datasets as one big dataset!
Code: Select all
model <- with(imputed, runMLwin(Formula = F1))
summary(pool(model)) <--- THIS WORKS
Alternative approach that I'm thinking about
I've deconstructed the imputed data into 10 datasets and am running the following code:
Code: Select all
model1 <- runMLwin(Formula = F1, estoptions=list(weighting=list(weightvar=c(NA, "Level1weight")), standardised=TRUE), data=imputed1)
model2 <- runMLwin(Formula = F1, estoptions=list(weighting=list(weightvar=c(NA, "Level1weight")), standardised=TRUE), data=imputed2)
**
**
model10 <- runMLwin(Formula = F1, estoptions=list(weighting=list(weightvar=c(NA, "Level1weight")), standardised=TRUE), data=imputed10)
When I apply the weights like this, I am able to run the models without errors BUT i'm unsure of how to pool the results!!
Is it possible to pool the results of several objects stored as "Formal class mlwinfitIGLS"?
Thanks so much. Please let me know if I can clarify anything!