# Median absolute deviation: impact/bias when forcing a median of zero

I want to estimate the median absolute deviation (MAD) of a signal. The MAD is defined as the median of the absolute difference between the signal and its median.

Now I have a signal that I know for a fact has a median of zero. Its empirical median of course is generally not equal to zero.

I was wondering if there would be any gain, or any loss, in the present case (e.g. in terms of bias or precision), in estimating the MAD as the median of the absolute value of the signal, i.e. by "forcing" the empirical median in the above computation to be zero.

• Where your assertion is correct (that the true median is 0), then you're better off using the known population value. However, in large samples it won't make much difference, and as the sample size grows the benefit diminishes toward 0. However, if the assertion is even slightly wrong, then as n grows, the purely-sample one will soon outperform the one based on the specified median. – Glen_b -Reinstate Monica Mar 5 '15 at 2:24

If you're estimating the MAD using the sample MAD without any correction, then using the true median instead of the empirical median will make your estimate less biased.

The sample MAD is a biased-low estimate of the true MAD, because you're really doing two steps of estimation:

1. Estimate the sample median $m$ from the data
2. Estimate the absolute deviation from $m$ using the same data

But in step 1 you're essentially selecting the $m$ that minimizes the result in step 2, so your result ends up being biased low. This is the same reason that, when calculating variance, one often divides the sum of squares by $n-1$ instead of by $n$: it corrects the bias from the nuisance parameter.

Anyway, the point is that if you know the true median, then you don't have this problem, and your sample MAD is an unbiased estimate of your true MAD. So you don't have to worry about making such corrections.

EDIT: However, as Glen_b points out in the comments, if your assumption of 0 median is even slightly wrong, then the estimate assuming 0 median will be much worse than the estimate using the sample median for large datasets. So be sure to at least check that a true median of 0 is consistent with your data, even if you know for a fact that it must be.

EDIT 2: A more formal argument since @AndrewM asked:

Take a sample $\{X_i\}_{i=1}^N$ of a r.v. $X$. Let $m$ be the true median and $\hat m$ be the sample median. The true MAD is $E_X(|X - m|)$; an unbiased estimate of this is $\frac1N \sum_i |X_i - m|$. Define $\text{mad}(y) := \frac1N\sum_i |X_i - y|$, so that $\text{mad}(m)$ is an unbiased estimator of the true MAD. Then the sample median is $\text{mad}(\hat m)$. But by the optimality property of the median, $\hat m$ is the minimizer of our $\text{mad}$ function. Therefore, unless $m = \hat m$ with probability 1, $E(\text{mad}(\hat m)) < E(\text{mad}(m))$ and the sample MAD is biased low.

• Your heuristic argument regarding the bias (attenuation) seems reasonable. Is there any theory to back it up? – Andrew M Mar 7 '15 at 2:14
• @AndrewM: I couldn't find any for the MAD, but here's the technical argument for why dividing by $n$ biases the variance low. I think a similar one should work for MAD. – Ben Kuhn Mar 8 '15 at 1:40
• @AndrewM: Turns out there's a better argument than the algebra bash in the Wiki article. I wrote it up to convince myself it was correct. See edit 2. – Ben Kuhn Mar 8 '15 at 17:53