Search

Search papers and lessons

Order Statistics

Level 3 · 14 min read

Order statistics are the values of a sample after sorting: the smallest, the largest, the median and every rank in between, each with its own distribution.

On this page

  • Colour = topic mix
  • Probability
  • Calculus
  • Discrete math
  • Sign in to see your progress

TL;DR

Take a sample of nn random values and sort them from smallest to largest. The values in sorted positions are the order statistics. The first is the minimum, the last is the maximum, and the middle one is the median. Each position has its own distribution, which you can compute from the distribution of a single draw.

They matter because many useful questions are about extremes or ranks, not averages: the slowest server in a cluster, the strongest of several candidates, the median of a noisy measurement.

Where you'll see it: in extreme value analysis of floods and wind speeds, in robust statistics that use the median, and in ranking methods that treat a race or a tournament as a sorted sample.

This is an educational explanation of probability and statistics. It is not medical advice.

Intuition

Sort the sample and ask about each slot

Suppose three friends each guess how long a bus will take, and their guesses are X1,X2,X3X_1, X_2, X_3. Sorting them gives X(1)≤X(2)≤X(3)X_{(1)} \leq X_{(2)} \leq X_{(3)}. The parenthesised subscript is the rank: X(1)X_{(1)} is the smallest guess, X(2)X_{(2)} the middle one, and X(3)X_{(3)} the largest.

Each sorted value is a random variable in its own right. It changes from sample to sample, and it has a distribution. The minimum of three guesses is usually lower than any one guess, and the maximum is usually higher. The middle value is more stable than either extreme. Order statistics describe exactly this pattern.

Why sorting changes the distribution

The original draws are independent and identically distributed, which means they all share the same distribution. Sorting destroys the labels but keeps the values, so the sorted values are no longer independent of each other. Knowing that the smallest value is 0.10.1 tells you that the middle one is at least 0.10.1. Independence is lost, but the distribution of each rank can still be found exactly.

The useful picture is this. For the kk-th smallest value to be at most xx, at least kk of the draws must be at most xx. That is a counting question about how many draws land below xx, and counting is something the binomial distribution already does.

00.20.40.60.8100.511.5xprobability
  • CDF of the maximum of 3 draws
  • CDF of one draw
The maximum of three uniform draws is more likely to be large than one draw is. At x = 0.5, the maximum is below 0.5 only with probability 0.125, against 0.5 for a single draw.

The math

Let X1,…,XnX_1, \dots, X_n be independent random variables with the same cumulative distribution function (CDF) F(x)=P(X≤x)F(x) = P(X \leq x) and the same probability density f(x)=F′(x)f(x) = F'(x), assuming the variables are continuous. Write X(k)X_{(k)} for the kk-th smallest value, so X(1)≤⋯≤X(n)X_{(1)} \leq \dots \leq X_{(n)}.

The minimum and the maximum

The maximum is at most xx exactly when every draw is at most xx. Independence lets us multiply:

P(X(n)≤x)=P(X1≤x,…,Xn≤x)=F(x)n.P\left(X_{(n)} \leq x\right) = P(X_1 \leq x, \dots, X_n \leq x) = F(x)^n.

The minimum is above xx exactly when every draw is above xx:

P(X(1)≤x)=1−(1−F(x))n.P\left(X_{(1)} \leq x\right) = 1 - \left(1 - F(x)\right)^n.

The general rank

The kk-th order statistic is at most xx exactly when at least kk of the nn draws are at most xx. Each draw falls below xx with probability F(x)F(x), so the count of draws below xx is binomial with parameters nn and F(x)F(x). Summing the binomial probabilities for counts j=k,…,nj = k, \dots, n gives

P(X(k)≤x)=∑j=kn(nj)F(x)j(1−F(x))n−j.P\left(X_{(k)} \leq x\right) = \sum_{j=k}^{n} \binom{n}{j} F(x)^{j} \left(1 - F(x)\right)^{n-j}.

Differentiating this CDF gives the density of the kk-th order statistic:

f(k)(x)=n!(k−1)! (n−k)! F(x)k−1(1−F(x))n−kf(x).f_{(k)}(x) = \frac{n!}{(k-1)!\,(n-k)!} \, F(x)^{k-1} \left(1 - F(x)\right)^{n-k} f(x).

The prefactor counts the ways to choose which draw is the kk-th smallest and how the others split around it. The term F(x)k−1F(x)^{k-1} says k−1k-1 draws lie below xx, and (1−F(x))n−k(1 - F(x))^{n-k} says n−kn-k lie above.

The uniform case

If the draws are uniform on [0,1][0, 1], then F(x)=xF(x) = x and f(x)=1f(x) = 1 on that interval, so the formulas simplify. The kk-th order statistic has density

f(k)(x)=n!(k−1)! (n−k)! xk−1(1−x)n−k,0≤x≤1.f_{(k)}(x) = \frac{n!}{(k-1)!\,(n-k)!} \, x^{k-1} (1 - x)^{n-k}, \qquad 0 \leq x \leq 1.

This is a Beta distribution with parameters kk and n−k+1n - k + 1. That is why order statistics of uniform samples appear in the theory of Beta distributions.

Expectations

For uniform draws the expected value of the kk-th order statistic is

E[X(k)]=kn+1.\mathbb{E}\left[X_{(k)}\right] = \frac{k}{n+1}.

So for nn uniform draws the kk values split [0,1][0, 1] into n+1n+1 roughly equal gaps on average. This is a useful sanity check on any calculation.

Worked examples

Example
The median of three uniform draws

Take n=3n = 3 draws from the uniform distribution on [0,1][0, 1], and let X(2)X_{(2)} be the median.

  1. The density formula with k=2k = 2 and n=3n = 3 has prefactor 3!1! 1!=6\dfrac{3!}{1! \, 1!} = 6.
  2. So f(2)(x)=6 x(1−x)f_{(2)}(x) = 6 \, x (1 - x) on [0,1][0, 1].
  3. Check that it integrates to 1: ∫016x(1−x) dx=6(12−13)=6⋅16=1\int_0^1 6x(1-x) \, dx = 6\left(\dfrac{1}{2} - \dfrac{1}{3}\right) = 6 \cdot \dfrac{1}{6} = 1.
  4. The expected median is kn+1=24=12\dfrac{k}{n+1} = \dfrac{2}{4} = \dfrac{1}{2}, which matches the symmetry of the density around 0.50.5.
  5. Probability that the median is at most 0.250.25, using the CDF with F(0.25)=0.25F(0.25) = 0.25: ∑j=23(3j)(0.25)j(0.75)3−j=3⋅0.0625⋅0.75+0.015625=0.140625+0.015625=0.15625\displaystyle\sum_{j=2}^{3} \binom{3}{j} (0.25)^j (0.75)^{3-j} = 3 \cdot 0.0625 \cdot 0.75 + 0.015625 = 0.140625 + 0.015625 = 0.15625.

Interpretation: a median of three uniform numbers falls in the bottom quarter only about 16 percent of the time, and it is most likely to land near the middle. The density peaks at 0.50.5 with height 1.51.5.

Example
The maximum of five draws in a load test

A load tester sends 5 requests to a server. Each response time, scaled to [0,1][0, 1], is treated as uniform. Find the chance that all five responses finish by the time 0.90.9, and the chance that at least one exceeds it.

  1. The maximum has CDF F(x)5=x5F(x)^5 = x^5.
  2. Evaluate at x=0.9x = 0.9: P(X(5)≤0.9)=0.95=0.59049P\left(X_{(5)} \leq 0.9\right) = 0.9^5 = 0.59049.
  3. The complement is the chance that at least one response is slower than 0.90.9: 1−0.59049=0.409511 - 0.59049 = 0.40951.
  4. The expected maximum is 56≈0.833\dfrac{5}{6} \approx 0.833.

Interpretation: even when each response is usually fast, five responses make it fairly likely that one is slow. About 41 percent of five-request tests would see at least one response above the cutoff, though any single request exceeds it only 10 percent of the time.

Example
The first failure among four machines

Suppose four machines have independent lifetimes, each exponentially distributed with rate λ=0.5\lambda = 0.5 per year, so P(T>t)=e−0.5tP(T \gt t) = e^{-0.5 t}. The first failure is the minimum T(1)T_{(1)}.

  1. The minimum exceeds tt only if all four machines survive past tt: P(T(1)>t)=(e−0.5t)4=e−2tP(T_{(1)} \gt t) = \left(e^{-0.5 t}\right)^4 = e^{-2t}.
  2. This is the survival function of an exponential distribution with rate 22, so the first failure has rate 4×0.5=24 \times 0.5 = 2 per year.
  3. Its expected value is 12\dfrac{1}{2} year, half a year, compared with 2 years for one machine.

Interpretation: adding machines shortens the time to the first failure in proportion to the number of machines.

Tradeoffs and failure modes

Order statistics are the right tool when the question is about a rank or an extreme. They are the wrong tool when the question is about totals or averages, where sums and the central limit theorem are more direct.

SituationWhat goes wrongBetter choice
Estimating a typical value from data with outliersThe sample mean is pulled by extreme valuesUse the median, which is an order statistic
Modelling the largest value of many drawsThe bulk of the distribution says little about the tailUse extreme value theory, which studies the limit distribution of the maximum
Treating sorted values as independentSorting creates dependence between ranksWork with the joint density of the ranks, or use the exact marginal formulas above
Asking about totals or averages of many drawsRanks and extremes say little about the sumUse Central Limit Theorem for sums
Ties in discrete dataThe density formulas assume continuous values, so ties break the counting argumentUse the discrete CDF and count carefully, or add a small jitter for analysis

The median and quantiles are the most common order-statistic tools in practice. Their robustness to outliers is the reason they appear in box plots and in summaries of skewed data.

History

Ranked samples have been studied since the early days of statistics, when researchers wanted to know how the largest or smallest observation in a group behaves. Problems about the range of a sample arose in quality control, where the spread of a few measurements gave a cheap estimate of variability.

The systematic theory of extremes began in the 1920s. Leonard Tippett studied the distribution of the largest and smallest values and the range in samples from a normal population. In 1928, Ronald Fisher and Tippett showed that, under suitable conditions, the distribution of the maximum of many draws settles into one of a small number of limit forms. That result, now called the Fisher–Tippett theorem, is the foundation of extreme value theory.

Order statistics caught on because they answer practical questions directly. Engineers use them to design structures for rare large loads, and researchers use the median and quantiles as robust summaries. The same ideas later supported ranking models, where the outcome of a contest is read off a sorted list of performances.

Check yourself

QuestionRecall: what does X(3)X_{(3)} mean when n=5n = 5, and what is its relationship to the median?Show answer

X(3)X_{(3)} is the third smallest of the five values, which is the middle value. For an odd sample size nn, the median is X((n+1)/2)X_{((n+1)/2)}, so with n=5n = 5 the median is X(3)X_{(3)}. Note that the subscript is a rank, not the index of the original draw. The original draws X1,…,X5X_1, \dots, X_5 carry no ordering information.

QuestionFive independent draws come from a distribution with CDF F(x)=xF(x) = x on [0,1][0, 1]. What is the probability that the maximum is at most 0.80.8?Show answer

The CDF of the maximum is F(x)5=x5F(x)^5 = x^5. At x=0.8x = 0.8 this gives 0.85=0.327680.8^5 = 0.32768. So the maximum is at most 0.80.8 with probability about 0.3280.328.

QuestionWhy does the probability that the minimum of nn draws exceeds xx equal (1−F(x))n(1 - F(x))^n rather than 1−F(x)1 - F(x)?Show answer

The minimum exceeds xx only if every draw exceeds xx. Each draw exceeds xx with probability 1−F(x)1 - F(x), and by independence the probabilities multiply over the nn draws. Using 1−F(x)1 - F(x) alone would describe a single draw, not the minimum of many. As nn grows, the minimum is driven down toward the lower end of the distribution, which is why it can be far smaller than a typical single draw.

QuestionFour independent uniform draws on [0,1][0, 1] are sorted. Find the expected value of the second smallest value, and the probability that it is at most 0.50.5.Show answer

With k=2k = 2 and n=4n = 4, the expected value is kn+1=25=0.4\dfrac{k}{n+1} = \dfrac{2}{5} = 0.4. For the probability, P(X(2)≤0.5)=∑j=24(4j)(0.5)j(0.5)4−j=(0.5)4∑j=24(4j)=6+4+116=1116=0.6875P\left(X_{(2)} \leq 0.5\right) = \sum_{j=2}^{4} \binom{4}{j} (0.5)^j (0.5)^{4-j} = (0.5)^4 \sum_{j=2}^{4} \binom{4}{j} = \dfrac{6 + 4 + 1}{16} = \dfrac{11}{16} = 0.6875. This matches the intuition that the second of four values is slightly below the centre, with expected value 0.4.

Sources