I am running some imputations using the mice package in R. During this process I need to use the as.mids function. However, it seems that as.mids change the values of my subsequent analysis - but I hope I am just doing something wrong.
Let's say I first impute 5 datasets.
imp1 <- mice(myData, m=5)
To prove my point, I want to duplicate "imp1" using the "complete" function followed by the "as.mids" function
#Creates a long/stacked dataframe from the 5 imputed datasets (+ original) impData <- complete(imp1, "long", include = TRUE) #The stacked dataframe is now converted to mids class named "imp2" imp2 <- as.mids(impData)
Now, as I see it - both imp1 and imp2 should be identical. However, when I run an analysis and pool the data the results turn out to be different.
#Runs both analysis fit1 <- with(imp, lm(A ~ B + C + D)) fit2 <- with(imp2, lm(A ~ B + C + D)) #Pools data from both pooled1 <- pool(fit1) pooled2 <- pool(fit2) #Get the results round(summary(pooled1), 3) round(summary(pooled2), 3)
Here are some examples from my data
#Results from imp1 est se t df Pr(>|t|) (Intercept) 7.844 0.316 24.832 8.648 0.000 B -0.013 0.002 -5.193 10.587 0.000 C 0.024 0.009 2.821 24.997 0.009 D 0.248 0.139 1.785 9.425 0.106 #Results from imp2 est se t df Pr(>|t|) (Intercept) 7.756 0.376 20.623 8.320 0.000 B -0.011 0.005 -2.361 5.800 0.058 C 0.024 0.008 2.780 35.214 0.009 D 0.229 0.140 1.637 11.967 0.128
As you can see, there are some differences. While these difference are not large, it is still unsettling because it indicates that I might have made some mistake or misunderstood something.
Is there someone who can explain why I get these results using as.mids function?