# R MICE imputation failing

I am really baffled about why my imputation is failing in R's Mice 2.22 package. I am attempting a very simple operation with the following data frame:

> dfn
a b c  d
1  0 1 0  1
2  1 0 0  0
3  0 0 0  0
4 NA 0 0  0
5  0 0 0 NA


I then use mice in the following way to perform a simple mean imputation:

imp <- mice(dfn, method = "mean", m = 1, maxit =1)
filled <- complete(imp)


However, my completed data looks like this:

> fill
a b c  d
1 0.00 1 0  1
2 1.00 0 0  0
3 0.00 0 0  0
4 0.25 0 0  0
5 0.00 0 0 NA


Why am I still getting this trailing NA? This is the simplest failing example I could construct, but my real data set is much larger and I am just trying to get a sense of where things are going wrong. Any help would be greatly appreciated!

• Ah, crap, this happened to me a month or two ago, but I forget what the problem was. Is it possible that those are dummy codes and that you've included all of them, i.e. is it possible that one of the variables is a (perfect) linear combination of some of the other variables? – Patrick Coulombe Dec 8 '14 at 5:43
• Okay, I think that that actually was the issue. I just constructed an example where there were no linear combos and it ran! If this occurs any suggestions on how to handle it in real data? – mjnichol Dec 8 '14 at 5:50