# Why shouldn't I post-process imputed values to missing, even if I'm using that variable as an imputation predictor?

The MICE package in R allows you to post-process imputed values, such that if impossible/unreasonable values are imputed (men being pregnant, people weighing negative pounds), they can be changed as you see fit before they are themselves used to impute other variables' values. Regarding this post-processing, the authors' companion article says: "be careful not the [sic] introduce any NA's if the variable is to be used as a predictor for another variable" (https://www.jstatsoft.org/article/view/v045i03). What's the basis for this concern? It's not a technical necessity, as the following example makes clear; here I post-process chl to be missing for those who are in the oldest age category, chl is used as a predictor for bmi and hyp, and everything seems to go through fine.

require(mice)
nhanes2
ini <- mice(nhanes2, max=0, print=F)
ini$post["chl"] <- "is.na(imp[[j]][,i]) <- data$age[!r[,j]]=='60-99'"
ini$predictorMatrix imp <- mice(nhanes2, post=ini$post, print=F)
complete(imp)


Obviously, the NAs will result in "less accurate" imputations of the other variables than if I kept the imputed values, but if the imputed values make no substantive sense, then their effect on the imputing of the other variables would make no substantive sense either (in my actual case, I am imputing survey data on presidents' perceived issue positions, and I want to impute, for example, USSR policy, but set it to NA after 1991). So my real question is, is there some invalid statistical operation that these post-processed NAs might be leading to, in this context or any context, even if the post-processed variable is used as a predictor in the imputation model? Or can I safely disregard the authors' words of caution if I have good substantive reason to introduce those NAs?

Although it might not give off a technical error, resetting a imputed cell to missing kind of defeats the purpose of imputation. Or at least, it distorts the needed technical steps (the iterations) in order to reach viable missing replacement values.

Why am I saying this? Take for example a dataset where there is one variable with missing values and a couple of other variables which contain some information about this variable's missingness. Imagine you want to build 10 imputation sets, with the mice default of 5 iterations to reach viable replacement values for each of the 10 datasets.

AFAIK, and probably somewhat simplified, imputation (by mice) works as follows:

1. Step 1 for the first iteration for the first imputation dataset would be to complete the dataset with a Gibbs sampler. This basically means inserting random values into all empty/missing cells.
2. Step 2 is building a proper prediction model to estimate values for the variable with missing values. This model is based on all values (known or imputed/replaced missing).
3. Step 3 is to replace the originally missing values for this variable based on the step 2 model, with some inherent randomness added/subtracted.
4. Step 4, repeat steps 2 and 3 another 4 times in order to reach 5 iterations of estimating missing data for one imputation dataset.
5. Step 5, repeat steps 1-4 another $x-1$ times for every $x$ imputation datasets you want to create ($x=10$ in this example).

This constant re-iteration process is exactly what makes imputation meaningful: if the associations between known data and the occurrence of a missing value are strong enough, the estimated missing values will be fairly constant and 'overpower' any inserted randomness, leading to multiple precise imputation estimates with low variation across imputed values. If these associations are not so strong, the randomness takes a leading role and variation increases.

However, and this part concerns your question, if you were to set a value to missing every time after step 3 (using the mice postprocessing option), you are starting every iteration as if it was the first. This completely undermines the associations in your data. Moreover, one of the diagnostics presented by Stef van Buuren in the mice package is to plot the imputed values and check whether the replaced values have stabilized (i.e. aren't still following a certain trend upwards or downwards) over the course of the iterations. Oddly enough, I'd expect this plot not to give you any trouble, as randomness across all iterations will probably look like a pretty stable band of imputed values. So don't be fooled, just think carefully.

To conclude, a better way to handle your 'USSR policy' would be to make an additional level for this categorical variable (I assume policy is categorical), something like 'USSR AFK', and set postprocessing to complete all missing values after 1991 with this level instead of NA.

• Thanks IWS, but I have two questions/issues with your answer. First, the algorithm does eventually stop and the post-processed NAs are left as NAs, not random or imputed values; and the companion article specifies that the post-processing is done within the sampler function, so, I assume, those NAs are also being "used," instead of sampled values, when the variable is used as a predictor, which is good for me. Second, if I created a missing-value level, wouldn't that lead to at least some nonsensical imputations of observations of that level in, say, the 1980's, where that level is impossible?
– DHW
Apr 6, 2017 at 14:57
• As to your first question: that is because after the final iteration you again postprocess and set any imputed values to NA. As to your second question, yes you are right, but you could adjust the postprocessing accordingly by defining a function which checks whether you have such a nonsensical imputation and re-run the estimation to get a sensible value. This might take some proper level coding though.
– IWS
Apr 6, 2017 at 15:09