# Rounding Binary Variables after Imputation in R

I performed stochastic regression imputation to handle missing data, using the mice package in R. The code I used is below:

library(mice)
stocImp <- mice(data1, method="norm.nob", m=1)
data2 <- complete(stocImp)


My question is as follows: stochastic regression and other imputation methods are not ideal for binary variables, as they result in values below 0 and above 1, as well as non-integers between 0 and 1. However, my dependent variable and some key independent variables are coded in binary. As a result, I cannot use the imputed data set in logistic regression analysis.

Does mice (or any other package) include any options to constrain the imputed values for binary variables to 0 and 1 only? If not, are there any other reliable rounding functions in any other packages? I carefully read the details for the mice function in the package documentation, but I was not able to locate anything to that effect. Therefore, I am hoping that someone can provide me with a hack for mice, or simply recommend another package.

• It is surprising that you would be attempting to impute the dependent variable: that is tantamount to making up data you don't have and don't need. (In effect, you're letting the imputation method fit part of your model for you, which would seem difficult to justify.) As far as independent variables go, you could consider using them as numeric regressors. – whuber Dec 12 '16 at 23:39
• Some methods do make it acceptable to impute the dependent variable. For details, please see: Enders, Craig K. 2010. Applied Missing Data Analysis. Guildford Press. – neutral Dec 12 '16 at 23:50

It turns out that there are several methods to apply rounding, but none of them are currently included in the major R packages on imputation. One important thing to remember though is that the methods that apply a 0.50 rounding are considered unreliable, and should be avoided, as they introduce bias into the data.

The debate on the issue is still ongoing, but there seems to be a consensus that two rounding methods stand out in terms of their relative degree of reliability. One is the Adaptive Rounding Procedure, developed by Bernaards and colleagues (2007), and the other is the Calibration Rounding, developed by Yucel and colleagues (2008). Scholars tend to favor the former slightly over the latter, so I posted a code on it here with a brief description: https://stackoverflow.com/questions/41111350/r-function-for-rounding-imputed-binary-variables

To summarize it here, the procedure involves normal approximation to a binomial distribution. That is, the imputed values in a binary variable are assigned the values of either 0 or 1, based on the threshold derived by the below formula, where x is the mean of the imputed binary variable:

threshold <- mean(x) - qnorm(mean(x))*sqrt(mean(x)*(1-mean(x)))


Find below the full citations of the above sources. Please also note that Enders (2010) has a short section titled "Rounding Binary Variables," where he demonstrates the application of both of the aforementioned methods (pp. 262-265).

Cited works:

Bernaards, Coen A.; Thomas R. Belin; and Joseph L. Schafer. 2007. "Robustness of a Multivariate Normal Approximation for Imputation of Incomplete Binary Data." Statistics in Medicine 26: 1368-1382.

Enders, Craig K. 2010. Applied Missing Data Analysis. Guildford Press.

Yucel, R.M.; Y He; and A.M. Zaslavsky. 2008. "Using Calibration to Improve Rounding in Imputation." The American Statistician 62:1-5.

• I agree with you. Imputation is not making up data. It uses other information from the data to come up with best estimates. I am not exactly sure whether or not your references mention multiple imputation. I think multiple imputation as introduced by Don Rubin has the advantage of inserting an estimate of uncertainty due to imputing values. I think the answer you give is worthwhile information but making it an answer to your own question is bad form and on top of that you check as your favored answer giving yourself reputation points! – Michael Chernick Dec 23 '16 at 19:55