# Which is better, replacement by mean and replacement by median?

I'm doing a project that involves replacing missing values in a set of data (first time doing this). This involves using two methods replacement by mean and replacement by median to fill in the missing values. There is not a lot of difference between the results of the minimum, median, maximum, mean and standard deviation of the data using both methods and I was wondering which method is better and how can I make a decision to which one is better using the results produced?

• If you replace missings with means, naturally the mean is preserved. Ditto medians. Nor will the extremes change. The SDs will typically be reduced slightly, but it would be reduced greatly if you do this a lot. These are predictable consequences of what you do and not ipso facto indications that the method is good. – Nick Cox Mar 27 '15 at 15:54
• Analysts plugging missing values (MVs) with automatic "solutions" like this aren't thinking through the consequences. It's just an easily implemented approach. This "solution" introduces as many problems as it solves since an otherwise typically smooth pdf ends up with a large spike at the plugged value, as a function of the number of MVs, of course. Model-based imputations are demonstrably superior and less biasing than any automated approach. @NickCox can't be ignorant of this, despite what his suggestion implies. – Mike Hunter Mar 18 '17 at 17:20
• :@DJohnson ... not ipso facto indications that the method is good. Not clear enough? – Nick Cox Mar 18 '17 at 19:46

## 2 Answers

It always depends on your data and your task.

If there is a dataset that have great outliers, I'll prefer median. E.x.: 99% of household income is below 100, and 1% is above 500.

On the other hand, if we work with wear of clothes that customers give to dry-cleaner (assuming that dry-cleaners' operators fill this field intuitively), I'll fill missings with mean value of wear.

It is better to start from data understanding and then this article will be helpful starting point.

• The data I'm using can range from 0 to 1 and I've created histograms with limits of 0.1,0.2,0.3...to 1. Because I have many different limits and outliners would you say that the mean is best? – Jake M-B Mar 27 '15 at 15:10
• @JakeM-B, it's hard give good advice, when I have not direct access to and history of the data. Often missing value in the data means that the value should be zero (or something else as default). On your place (if there is no great difference between mean and median), I would try both of them and check how it influence the outcome result. – Aleksandro M Granda Mar 27 '15 at 15:19

Imputation is a means to a goal, not the goal in itself. In some circumstances, replacing missing data might be the wrong thing to do. Make sure that you first pay attention to why your data are missing, as explained for example in the Missing data Wikipedia page, and that imputation is actually appropriate for answering the question your project seeks to answer.

If some assumptions are met (for example, if the probability of a variable having a missing value does not depend on the value itself, technically called "missing at random") and your study involves multiple variables, you might be better off using multiple imputation rather than replacements by means or medians. In multiple imputation, known values of all variables are used to provide several sets of estimates of the missing data. This approach can provide better estimates both of the underlying relations among the variables and of the reliability of your estimates. See questions on this site having the multiple-imputation tag for more information.