0
$\begingroup$

If we can use the median to replace all of the missing values from a column, then what is the advantage of using median over mean for replacing the missing values in a column with numeric values?

$\endgroup$
1
$\begingroup$

imputing with median/mean affects distibution of the data, essentially squeezes it, and it does not account for variance in the data, not to mention we'll be making up data. Of course, there're some cases that it may not matter as much and some cases where it will.

If it's worthwhile your time and in case it adds value to your work, you can look into other methods such as proper stochastic regression imputation. Using this method you can randomly add value using linear regression imputation method and create several models and aggregate the results. In this case you'll be accounting for variance in your data and not essentially makin up data, but it's more computationally consuming of course in comparison to just fillna.

There's new method to impute values based on missing patterns, where you'll break your data based on the pattern and create models for each and aggregate. Of course if it's worth the time and effort, these methods should be more beneficial. Also you can look into python's fancyimpute

Here are some good resources that cover various methods of imputing missing values: 1) http://www.stat.columbia.edu/~gelman/arm/missing.pdf 2) http://www.bu.edu/sph/files/2014/05/Marina-tech-report.pdf 3) https://stefvanbuuren.name/fimd/sec-nonnormal.html 4) https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2727536/

$\endgroup$
  • $\begingroup$ link-only answers are discouraged.. please summarize the contents as links can become outdated. thank you. $\endgroup$ – oW_ Jul 25 at 17:30
  • $\begingroup$ Thank you for answering $\endgroup$ – raghav gaur Jul 27 at 10:00
  • $\begingroup$ @oW_ of course) thank you! $\endgroup$ – Angela Jul 27 at 16:33
  • $\begingroup$ @raghavgaur sure $\endgroup$ – Angela Jul 27 at 16:34
0
$\begingroup$

Sure. It will be less sensitive to outliers. Whether or not it's a better approach depends entirely on your dataset; you should use cross-validation to see which approach results in a more successful predictor.

$\endgroup$
  • $\begingroup$ Thank you for answering $\endgroup$ – raghav gaur Jul 27 at 9:59
0
$\begingroup$

The numerical column may contain very large as well as very small values. These values are not necessarily normal behavior, these could be outliers. The majority of the values lie in a particular range. This range is easier to find from the median of the numerical column. This is the only advantage.

Mean and median values are mostly very close to each other. You can make your own choice here.

$\endgroup$
  • 1
    $\begingroup$ Thank you for the answer $\endgroup$ – raghav gaur Jul 27 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.