Huber location response to one outlier (source code)

= Huber location response to one outlier
{c}
{title2=$T(M)$}

Hold $(0,1,2,3,4)$ fixed and move only the sixth observation $M$. For $M\geq5$, the <sample mean> is $(10+M)/6$, the <sample median> is $2.5$, and the <Huber location estimator> with fixed $s=1,k=2$ stays at $2.5$. Once $M-2.5\geq2$, its <Huber score> is already $2$; moving it farther changes the <Huber loss> but leaves the root unchanged.

For a closer view of the transition, the exact <Huber location estimator> over $0\leq M\leq40$ is
$$
T(M)=\begin{cases}(8+M)/5,&0\leq M\leq4.5,\\2.5,&4.5\leq M\leq40.\end{cases}
$$
To verify the first branch, when $0\leq M\leq2$ the score of $4$ is saturated and the other five scores sum with it to $8+M-5\theta$. When $2\leq M\leq4.5$, the score of $0$ is saturated instead, giving the same expression. At $M=4.5$, the moving observation saturates too, and the equation becomes $10-4\theta=0$. The piecewise formula is continuous at the transition.

\Image[/huber-location-outlier-response.png]
{title=One moving observation: <sample mean>, <sample median>, and fixed-scale <Huber location estimator>}
{description=Original deterministic data $(0,1,2,3,4,M)$ with $s=1,k=2$. The inset resolves the region $0\leq M\leq6$, where the three <estimators> differ; the <Huber location estimator> saturates at $M=4.5$. For $5\leq M\leq40$, it coincides with the <sample median>, while the <sample mean> continues to rise.}

The rising <sample mean> comes from an unbounded linear score, the flat distant-outlier response from a bounded <Huber score>. This is a finite-data response curve with a specified scale and threshold, rather than a population <influence function> or a general claim about arbitrary numbers of <outliers>.