# Median absolute deviation

In statistics, the median absolute deviation (MAD) is a robust measure of the variability of a univariate sample of quantitative data. It can also refer to the population parameter that is estimated by the MAD calculated from a sample.

For a univariate data set X1X2, ..., Xn, the MAD is defined as the median of the absolute deviations from the data's median ${\tilde {X}}=\operatorname {median} (X)$ :

$\operatorname {MAD} =\operatorname {median} (|X_{i}-{\tilde {X}}|)$ that is, starting with the residuals (deviations) from the data's median, the MAD is the median of their absolute values.

## Example

Consider the data (1, 1, 2, 2, 4, 6, 9). It has a median value of 2. The absolute deviations about 2 are (1, 1, 0, 0, 2, 4, 7) which in turn have a median value of 1 (because the sorted absolute deviations are (0, 0, 1, 1, 2, 4, 7)). So the median absolute deviation for this data is 1.

## Uses

The median absolute deviation is a measure of statistical dispersion. Moreover, the MAD is a robust statistic, being more resilient to outliers in a data set than the standard deviation. In the standard deviation, the distances from the mean are squared, so large deviations are weighted more heavily, and thus outliers can heavily influence it. In the MAD, the deviations of a small number of outliers are irrelevant.

Because the MAD is a more robust estimator of scale than the sample variance or standard deviation, it works better with distributions without a mean or variance, such as the Cauchy distribution.

## Relation to standard deviation

The MAD may be used similarly to how one would use the deviation for the average. In order to use the MAD as a consistent estimator for the estimation of the standard deviation $\sigma$ , one takes

${\hat {\sigma }}=k\cdot \operatorname {MAD} ,$

where $k$  is a constant scale factor, which depends on the distribution.

For normally distributed data $k$  is taken to be

$k=1/\left(\Phi ^{-1}(3/4)\right)\approx 1.4826,$

i.e., the reciprocal of the quantile function $\Phi ^{-1}$  (also known as the inverse of the cumulative distribution function) for the standard normal distribution $Z=(X-\mu )/\sigma$ . The argument 3/4 is such that $\pm \operatorname {MAD}$  covers 50% (between 1/4 and 3/4) of the standard normal cumulative distribution function, i.e.

${\frac {1}{2}}=P(|X-\mu |\leq \operatorname {MAD} )=P\left(\left|{\frac {X-\mu }{\sigma }}\right|\leq {\frac {\operatorname {MAD} }{\sigma }}\right)=P\left(|Z|\leq {\frac {\operatorname {MAD} }{\sigma }}\right).$

Therefore, we must have that

$\Phi \left(\operatorname {MAD} /\sigma \right)-\Phi \left(-\operatorname {MAD} /\sigma \right)=1/2.$

Noticing that

$\Phi \left(-\operatorname {MAD} /\sigma \right)=1-\Phi \left(\operatorname {MAD} /\sigma \right),$

we have that $\operatorname {MAD} /\sigma =\Phi ^{-1}(3/4)=0.67449$ , from which we obtain the scale factor $k=1/\Phi ^{-1}(3/4)=1.4826$ .

Another way of establishing the relationship is noting that MAD equals the half-normal distribution median:

$\operatorname {MAD} =\sigma {\sqrt {2}}\operatorname {erf} ^{-1}(1/2)\approx 0.67449\sigma .$

This form is used in, e.g., the probable error.

## Geometric median absolute deviation

Similarly to how the median generalizes to the geometric median in multivariate data, a geometric MAD can be constructed that generalizes the MAD. Given a 2 dimensional paired set of data (X1,Y1), (X2,Y2),..., (Xn,Yn) and a suitably calculated geometric median $({\tilde {X}},{\tilde {Y}})$ , the geometric median absolute deviation is given by:

$\operatorname {MAD} ={\Bigl (}\operatorname {median} (|X_{i}-{\tilde {X}}|)^{2}+\operatorname {median} (|Y_{i}-{\tilde {Y}}|)^{2}{\Bigr )}^{1/2}$

This gives the identical result as the univariate MAD in 1 dimension and extends easily to higher dimensions. In the case of complex values (X+iY), the relation of MAD to the standard deviation is unchanged for normally distributed data.