Tukey median (source code)

= Tukey median
{c}
{wiki}

A <Tukey median> maximizes <halfspace depth>. For a <probability measure> $P$ on $\mathbb R^d$, the depth of a point $x$ is
$$
D(x;P)=\inf\{P(H):H\text{ is a closed half-space containing }x\}.
$$
For a sample, $P$ is replaced by its <empirical distribution>, so $P(H)$ is the fraction of observations in the <closed half-space> $H$. Every direction is considered; choosing a single coordinate direction would give a different procedure.

In one dimension, the depth is the smaller of the masses in the closed rays to the left and right of $x$. For the sample $(0,1,2,3,100)$, point $2$ has depth $3/5$, while $100$ has depth $1/5$. The maximizing point is the <sample median>. In higher dimensions this gives a geometric extension of a central location that depends on how many observations lie on each side, rather than on their squared distances. Maximizers need not be unique, so a single-valued <estimator> needs a selection rule.