# Variable-specific random sample imputation. Is it a valid method of imputation?

Is random sample imputation a valid method of imputation for categorical variables? Not randomly drawing from any old uniform or normal distribution, but drawing from the specific distribution of the categories in the variable itself.

As a simple example, consider the Gender variable with 100 observations. Male has 64 instances, Female has 16 instances and there are 20 missing instances. Before imputation, 80% of non-missing data are Male (64/80) and 20% of non-missing data are Female (16/80). After variable-specific random sample imputation (so drawing from the 80% Male 20% Female distribution), we could have maybe 80 Male instances and 20 Female instances, thus preserving the original 80% Male 20% Female distribution.

Imputing this way by randomly sampling from the specific distribution of non-missing data results in very similar distributions before and after imputation. If mode imputation was used instead, there would be 84 Male and 16 Female instances. More biased towards the mode instead of preserving the original distribution.

My question: is this a valid way of imputing categorical variables? What are its strengths and limitations? What are better alternatives to random sample imputation?

Edit: My medical dataset is indeed multivariate, with around 200 integer encoded categorical features and 20000 instances (and a binary target). I tried Predictive Mean Matching as I found that it is the best imputation method. However, it took ages to run on 1000 instances and produced an error, and even the GPU from Google Colab gave up on it. What would be a nice multiple imputation method that makes a good compromise between execution time and imputation performance, without having to draw on massive parallel computing power from the Cloud?

Random imputation is certainly a valid imputation method, though it is not often used as there are better alternatives. It’s advantages are; it preserves the distribution of the data, it is easy to implement, is computationally efficient and has the benefit of only imputing values that are observed in the dataset.It is also unbiased under the missing completely at random assumption.

It does however perform worse than other methods under situations such as missing at random or missing not at random that are more likely to actually be true in practice. A better method might be k nearest neighbour donor imputation where the random value is selected from the k nearest neighbours instead of from the entire dataset. This will perform better than simple random imputation under MAR and MNAR but is more computationally expensive and harder to implement.

If this is a multivariate dataset, randomly imputing missing values based on the records available from that same variable is generally not a good way to proceed.

1. The records with missing values may represent a non-homogeneous subset of the overall population, and have different statistical properties from the overall data.

2. There may be strong correlations between fields in your data records. To use a trivial but illustrative example, if you have a dataset on professional basketball players, simply assigning random values could cause you to end up with records describing female professional basketball players who are over 7 feet tall.

In the fully general case, I don't know that you could get away with anything simpler than a Gibbs sampler to generate reasonable imputed values.

The good news is that, with categorical data, missing values can almost always be treated "as is", as their own category of "Unknown", and run through whatever other steps you are taking to analyze your dataset.

• I will try implementing the Gibbs sampling imputation method. Is it the simplest possible multiple imputation method, compared to Logistic Regression, KNN or MICE imputation? Oct 29 '20 at 8:27

As @astel notes, there are much better choices available. Stef van Buuren describes options for imputation of categorical data in Section 3.6 of his freely accessible Flexible Imputation of Missing Data. Briefly, the best way to proceed is with probabilistic approaches based on logistic (or multinomial, for multi-class problems) regression, using as much information as is available on the joint association of other predictors with the variable having the missing values.

Most important, don't forget that it's not adequate to rely on a single imputation. Multiple imputation, covered extensively by van Buuren, along with modeling several imputed data sets and combining results from those model, is needed.

• I don’t think it is fully correct to say that single imputation is not adequate. For analysis maybe, but for example national statistical organizations have to do single imputation when they release their surveys as they cannot release multiple datasets for the same survey. So it really depends on the context. Oct 28 '20 at 17:42
• I’ll also note that logistic regression techniques are not necessarily “the best” as you mention. Again I think it depends on the context. For imputation for surveys at NSOs it is almost exclusively done using nearest neighbor donor imputation. Oct 28 '20 at 17:45
• @astel your points about NSOs are well taken. It seemed that the OP was referring to an analysis context, so I answered in that context.
– EdM
Oct 28 '20 at 17:48