Laplace median robustness example (source code)

= Laplace median robustness example
{c}

Choose the five numbers $1,2,2,5,10$ as an original illustration. Their <sample median> is 2 and their <sample mean> is 4. The sum of <absolute losses> at the <sample median> is
$$
S(2)=|1-2|+|2-2|+|2-2|+|5-2|+|10-2|=1+0+0+3+8=12.
$$
If these numbers were modeled as an <independent and identically distributed> <Laplace distribution> sample, the joint <maximum-likelihood estimates> would therefore be $\widehat\mu=2$ and $\widehat b=12/5=2.4$. Using the <sample mean> instead gives $S(4)=14$, so it does not maximize this <likelihood function>.

Now replace only 10 by 100. The <sample median> stays at 2, while the <sample mean> becomes $(1+2+2+5+100)/5=22$. The minimized sum of <absolute losses> rises to $S(2)=102$, and the fitted scale rises to $\widehat b=102/5=20.4$. Stability of the fitted location therefore does not mean stability of every fitted parameter.

\Image[/laplace-absolute-loss-and-median-robustness.png]
{title=Chosen five-value example: moving the largest value leaves the median fixed but moves the mean}

The left panel subtracts each objective's minimum so the two <absolute loss> curves can be compared despite the different totals. The right panel tracks the <sample mean> and <sample median> as the largest chosen value changes. This is an <outlier> sensitivity illustration, not actual observations or a check that a <Laplace distribution> fits any population. In applications, <regression residuals> and the data-generating assumptions need separate examination; a stable <sample median> alone does not validate a <statistical model>.