# How does the mice imputation function work?

I was wondering if anyone had experience using the mice function, as described in mice: Multivariate Imputation by Chained Equations in R (JSS 2011 45(3))? I have a dataset with a number of variables, each with varying degrees of missing data.

My primary question is: say I use Bayesian linear regression to impute missing data, does mice automatically use predictor variables from most significant to least significant to impute? Also, is it common to perhaps average all the imputed datasets?

• Hi all. Further to this: I have since been able to use the mice function successfully. I have another query. Say for example the function creates 5 complete datasets (X1, X2...X5). I apply function(x) over each dataset and it returns Y1, Y2...Y5. Do you think it would be OK to maybe report the range Ymin to Ymax? Or maybe the average of Y1 to Y5? Anyone have any thoughts on the matter? Thanks. Jun 4, 2012 at 23:19

By default, mice will use all the variables in your dataset to predict any other one.

As for averaging, you need to do this after calculating your stats, not before. For instance, if you want to do a linear regression, you'd do something like this:

library(mice)
mi <- mice(dataset)
mi.reg <- with(data=mi,exp=glm(y~x+z))
mi.reg.pool <- pool(mi.reg)
summary(mi.reg.pool)


The summary function will show you the averaged coefficients.

• Thanks for that - are you saying that I should only average once I have checked that the stats are "OK"? Also - my dataset has 6 variables in it. How do I analyse the stats using linear regression? Do I have to check each variable separately? For example, lm(x1 ~ x2 + x3 + x4 + x5 ....) May 9, 2012 at 2:33
• You must be referring to the verification of assumptions? The most important thing to check is the residuals of your model (including all predictors). I'd probably stick to the complete-case analysis for doing that (before multiple imputation), but you might want to ask for advice from an experienced statistician (which I'm not). May 9, 2012 at 3:07
• @mjburns: In dominic999's example, the averaging is of the coefficients that result from fitting the same linear model to each of the multiple versions of the multiply-imputed dataset. I don't think it makes sense to average the datasets themselves, since you'd lose the (hopefully justified and realistic) variability that multiple imputation provides. The summary statistics for the pooled (averaged) results are much the same as for a regular linear model (at least in terms of the coefficients themselves) where you have to look at the Pr (>|t|) for the significance of each. May 9, 2012 at 3:46
• Please consider voting up/accepting the answer if it served your purpose well. May 9, 2012 at 18:44
• Thanks dominic999 and Wayne. I now understand what is going on much more after following your hints and playing with the data more. May 10, 2012 at 6:37