Order statistic (source code)

= Order statistic
{title2=$X_{(r)}$}
{wiki}

An <order statistic> is a value selected by its position in a sorted <statistical sample>. For real observations $X_1,\ldots,X_n$, write
$$
X_{(1)}\leq X_{(2)}\leq\cdots\leq X_{(n)}.
$$
The $r$th <order statistic> $X_{(r)}$ is the $r$th smallest value, counting repeated values separately. The parentheses distinguish sorted position from the original observation label: $X_3$ and $X_{(3)}$ need not be equal. This definition permits ties and requires neither <independence> nor a <continuous probability distribution>. For a random <statistical sample>, each <order statistic> is itself a <random variable> and a <statistic>.

For example, the five fixed observations
$$
(x_1,x_2,x_3,x_4,x_5)=(0.7,0.1,0.9,0.4,0.2)
$$
sort to
$$
(x_{(1)},x_{(2)},x_{(3)},x_{(4)},x_{(5)})=(0.1,0.2,0.4,0.7,0.9).
$$
Their original indices in sorted order are $(2,5,4,1,3)$, so $x_{(3)}=x_4=0.4$. Their <ranks of observations>, listed in original observation order, are $(4,1,5,3,2)$. Here $x_{(1)}=0.1$ is the <minimum>, $x_{(5)}=0.9$ is the <sample maximum>, and $x_{(3)}=0.4$ is the <sample median>. These are deliberately chosen observations, rather than simulated draws.

\Image[/order-statistic-sort-and-ranks.png]
{title=Five observations: original indices, sorted positions, and the third order statistic}

<Order statistics> put extremes and typical values in one language: the first and last locate the <minimum> and <sample maximum>, while intermediate positions give <sample quantiles> and the <sample median>. Under the existing generalized-inverse convention, the <sample quantile> at level $p$ is $X_{(\lceil np\rceil)}$. For the five observations, the <sample quantiles> at $p=0.2,0.5,0.8$ are $0.1,0.4,0.7$. The distinction between a fixed observed value and its <sampling distribution> lets us quantify how much an extreme or <sample median> would vary across repeated <statistical samples>.

The useful counting identity is
$$
\{X_{(r)}\leq t\}=\{\text{at least }r\text{ of the observations are at most }t\}.
$$
For <independent and identically distributed random variables> with a continuous <cumulative distribution function> $F$, the count on the right has <binomial distribution> with parameters $n,F(t)$, giving
$$
\mathbb P(X_{(r)}\leq t)=\sum_{k=r}^{n}\binom{n}{k}F(t)^k[1-F(t)]^{n-k},\qquad 1\leq r\leq n.
$$
This <cumulative distribution function> is a <binomial distribution> tail: a question about sorting becomes a question about counting successes in <Bernoulli trials>. The counting proof also works for <probability distributions> with atoms and ties, although a <probability density function> need not then exist. For a <uniform order statistic>, $F(t)=t$ on $0\leq t\leq1$, which makes the formula particularly explicit.