# Can we detect the existence of outliers using mean and median?

Suppose, I have a data set with eight features in my hand.

I have juxtaposed their means and medians row by row.

            f1       f2        f3        f4        f5        f6        f7        f8
mean      2.5000    0.1868    0.0148    0.2105    0.2088   79.6583    1.0604    0.0091
median    2.5000    0.1826    0.0001    0.0002    0.0000   -0.0000    0.0000   -0.0000


Can we tell anything about the existence of outliers from these information?

• Not from just that. Not only does mean not equal to median not tell you there are outliers, mean $\approx$ median (or even exactly equal) doesn't tell you there aren't. Nov 26, 2016 at 8:44

Without any further knowledge I don't think so. You can construct a dataset that has a specific mean and variance by doing the following:

• Let the mean be $\mu$ and the median $m$ and the number of elements n.
• Put $n+1$ elements at m and $n$ at position $x$. We can find $x$ using $n,m,\mu$: $$\frac{nx+(n+1)m}{2n+1} = \mu \Rightarrow x = \frac{(2n+1)\mu-(n+1)m}{n}$$

We've created a dataset with no outliers (two huge clusters) for any given pair of $\mu, m$.

Possible knowledge that could help

Lots of times data is usually distributed more uniformly/continuously, not like my counterexample. In particular if the distribution is pretty centered (like a Gaussian) and there's an outlier, it will heavily influence the mean but not the median and this can be perceived.

However, if the distribution is not centered (like a geometric distribution) a big difference between mean and median may not mean much.

• What kind of further knowledge can help in this regard? Nov 26, 2016 at 7:57