Skip to main content
8 of 11
added 4 characters in body
Nick Cox
  • 59.5k
  • 8
  • 136
  • 212

Three facts will help you here.

  • What you discovered is called the exact fit property. If a proportion $\alpha > 0.5$ of the observations in your sample have the same value, the mad of your sample will be 0.
  • This is not a property of the mad in particular, but of all robust estimators of scale. More precisely: any robust estimator of scale with a breakdown point of $0< \alpha < 0.5$ will have an exact fit property at the level of $1-\alpha$ (see section 3 of Croux et al., 2006, [0], for example).
  • Your first proposals amount to replacing the value of $M_i$ by arbitrary numbers in case of exact fit (setting $M_i=0$ in the former and $M_i=O(1/\sigma)$ --where $\sigma$ is the amount by which you perturb the data-- in the latter).

Both 'fixes' you propose suggest you think that, in the presence of an exact fit, the MAD is broken and becomes useless for describing the sample and that the outliers detection rule based on it does not work. (It doesn't quite follow from this that you would still prefer to set $M_i$ to an arbitrary number, but let us set that aside for now.) But this assessment is not warranted. To wit:

In an exact fit situation whereby half or more of the data is tied at an arbitrary value $x$, all observations in your sample that are different from $x$ are severe outliers.

All observations in your sample that are different from $x$ are, after all, infinitely divergent from the pattern of the bulk of the data.

That is, exact fit breaks neither the MAD nor the outlier detection rule based on it. The last point is the salient one. If you use the convention $0/0:=0$ in the computation of the outliers detection rule, then you can use it regardless of whether the MAD is strictly positive or not.

The reason you can use this convention is because the exact fit property is bijective:

Mad = 0 $\iff$ more than half of your sample are tied to the same value.

  • Algorithms for projection-pursuit robust principal component analysis. (2006). Croux, C. Filzmoser, P. and Oliveira, M. R.
user603
  • 23k
  • 3
  • 88
  • 155