# Is distance from the median instead of from the mean in standard deviation calculation meaningful in case of data with outliers?

I'm borrowing from the idea of Mean of absolute deviation around the median (https://en.wikipedia.org/wiki/Average_absolute_deviation#Mean_absolute_deviation_around_the_median). Would calculating standard deviation from the median instead of the mean be a good variance measure in the situation where the data has fairly significant outliers?

• not really. The outliers would still impact in your measure of spread. Jul 19, 2023 at 17:53
• yes, certainly outliers won't simply go away. but is the idea that median is a better representation of the center of the data than mean when there are outliers apply to the standard deviation calculated off the median? is it a completely nonsensical measure? Jul 19, 2023 at 17:56
• It's conceptually inconsistent. Since you want to use estimators of location and spread that are resistant to the effects of outliers (or, ideally, independent of the outliers altogether), then you want to employ something like a quantile of the absolute deviation from the median. The standard one is the median absolute deviation from the median. Using a standard deviation is counterproductive because it's even more sensitive to outliers than the mean is.
– whuber
Jul 19, 2023 at 18:03
• In the computation of the mean, outliers have a linear impact. In the computation of the variance from which the standard deviation is derived, outliers have a squared impact. So the outlier will affect the sd worse than the mean. Replacing the mean by the median but still using the sd will not help. Jul 26, 2023 at 10:17
• You may want to look at en.wikipedia.org/wiki/Robust_measures_of_scale. In particular Rousseeuw has written a fair amount on this topic such as Rousseeuw & Croux (1993) on alternatives to MAD and Rousseeuw & Verboven (2001) for small samples. The R package robustbase implements some of Rousseeuw's work and revss implements much of Rousseeuw & Verboven Jul 26, 2023 at 10:30

No, this won't work well. It might work slightly better than the usual SD, but, still, outliers are outliers. So, a toy example:

x <- c(1,2,3,4, 20)
median(x) #3
sqrt(4 + 1 + 0 + 16^2) #16.16


Now, what is 16.16? Does it mean anything? It's certainly very sensitive to the outlier! In fact, the result is based almost entirely on the outlier. Is that what you want?

As @whuber says, above, much more common (and, I think, more useful) is the median absolute deviation around the median. For the above that is 4,

You can also use the IQR, or the full range, or the old-fashioned but still useful, five and seven number summaries from Tukey (I highly recommend Tukey's book EDA, which shows what you can do with a pen and paper and brains).

Also, if there are outliers on both ends, then the mean and median may be close, and your measure doesn't gain much.

I think this is a bad idea, getting the advantages of neither standard deviation nor medians.

The advantage of standard deviation is that it has the advantages of variance in more convenient units.

The advantages of variance begin with $$Var[X]+Var[Y]=Var[X+Y]$$ when $$X$$ and $$Y$$ are independent. This is what allows us to talk about variance due to $$X$$ and variance due to $$Y$$.

No median-based measure of deviation will have a property like that. This is because means are additive: $$E[X]+E[Y]=E[X+Y].$$ But medians, which I denote by $$M$$, are not additive: $$M[X]+M[Y]\neq M[X+Y].$$

So the proposed alternative to standard deviation will not decompose nicely into contributions from independent causes.

Nice Formulas

Standard deviations also are easy to use with many common distributions, since they have nice formulas. But those nice formulas rely on variance being expressible as either side of the identity $$E[(X-E[X])^2]=E[X^2]-E[X]^2$$ Change an $$E$$ to an $$M$$ there, and the whole equation will break down. So the proposed alternative to standard deviation will have a messy formula for almost any asymmetric distribution.

A Better Alternative

For a measure of dispersion that avoids the impact of outliers, calculate the interquartile range! That works well with medians, and with $$L$$-moments and robust statistics generally.