Tutorials › Statistical Theory I - Probability and Distribution Theory › A Worked Exact-Probability Workshop for Ranks and Quantiles

Ranks, Spacings, and Empirical Laws · Tutorial 494 of 994

A Worked Exact-Probability Workshop for Ranks and Quantiles

Translate rank and quantile events into finite counts, then calculate their probabilities exactly under continuity and independent sampling.

Advanced 9 min read

What You'll Learn

  • Compute probabilities of specified rank assignments by counting permutations.
  • Express sample-quantile bracket events as restrictions on the number of observations below a population quantile.
  • Derive exact binomial probabilities for empirical-CDF threshold events.
  • Check strict and non-strict inequalities by translating them into order-statistic counts.
  • Identify when ties or a discontinuous distribution invalidate these calculations.

From Rank Language to Exact Counts

Exact probabilities for ranks and quantiles often look complicated because the event is described through ordered observations rather than through a direct count. A useful strategy is to identify what must be counted: possible permutations of observation labels, observations on one side of a fixed threshold, or counts in several intervals. In the continuous independent-sampling settings considered here, these descriptions lead to finite calculations rather than approximations.

Throughout, let \(X_1,\ldots,X_n\) be independent and identically distributed from a continuous distribution \(F\). Continuity ensures that ties occur with probability zero, so the order statistics \(X_{(1)}<\cdots<X_{(n)}\) are distinct with probability one. The rank of \(X_i\) is the index \(r\) for which \(X_i=X_{(r)}\). For a fixed threshold \(t\), write \(N(t)=\sum_{i=1}^n \mathbf{1}\{X_i\le t\}\). The empirical distribution function is \(F_n(t)=N(t)/n\).

Definition: For \(0<p<1\), the population \(p\)-quantile \(q_p\) used below is a fixed value satisfying \(F(q_p)=p\). The empirical quantile uses the inverse convention \(\hat q_p=\inf\{x:F_n(x)\ge p\}\). For a sample with no ties, \(\hat q_p=X_{(\lceil np\rceil)}\).

The condition \(F(q_p)=p\) is important: it makes the probability that one observation is at or below \(q_p\) equal to \(p\). If \(F\) has a jump or the selected quantile does not satisfy this equality, the binomial success probability must instead be \(F(q_p)\); it cannot automatically be replaced by \(p\).

Specified Ranks Are Permutation Events

Because the observations are independent with the same continuous distribution, each of the \(n!\) possible orderings of their labels is equally likely. To see why, permuting the labels leaves the joint distribution unchanged, and the no-ties event divides the sample space into \(n!\) disjoint ordering events. Their probabilities are equal and sum to one. Thus any one ordering has probability \(1/n!\).

Theorem: For an independent sample from a common continuous distribution, every ordering of the \(n\) observation labels has probability \(1/n!\). If \(m\) specified labels are required to occupy specified distinct ranks, the probability is \((n-m)!/n!\).

For the second statement, fix the ranks of the \(m\) labels. The other \(n-m\) labels can be assigned to the remaining ranks in \((n-m)!\) ways. Each complete ordering has probability \(1/n!\), so adding the probabilities of these disjoint orderings gives \((n-m)!/n!\). The ranks must be distinct; assigning two different labels to the same rank is impossible.

Worked Example: Two Named Observations at Specified Ranks

Let \(n=6\). Find the probability that \(X_2\) is the second-smallest observation and \(X_5\) is the fifth-smallest observation.

There are \(6!=720\) equally likely orderings of the six labels. The event fixes the labels at ranks 2 and 5. The remaining four labels can occupy ranks 1, 3, 4, and 6 in \(4!=24\) ways. Therefore

$$ P\{\operatorname{rank}(X_2)=2,\ \operatorname{rank}(X_5)=5\} =\frac{4!}{6!} =\frac{24}{720} =\frac{1}{30}. $$

This is not the probability that the two observations happen to be in the order \(X_2<X_5\). That weaker event places no restrictions on their exact ranks and has probability \(1/2\), since either of their two relative orders is equally likely.

Rank statements involving only relative order can be counted the same way. For example, among three specified labels, each of their \(3!\) relative orders is equally likely, even though the other observations may appear anywhere among them. This distinction between a relative-order event and a specified-ranks event prevents a common counting error.

Quantile Brackets Become Binomial Events

Fix \(q_p\) with \(F(q_p)=p\), and let \(N=N(q_p)\) count observations at or below it. Each indicator \(\mathbf{1}\{X_i\le q_p\}\) equals one with probability \(p\), and the indicators are independent. Consequently, \(N\) has the binomial distribution with parameters \(n\) and \(p\). The position of \(q_p\) among the order statistics is determined exactly by this count.

Theorem: Suppose \(X_1,\ldots,X_n\) are independent from a continuous distribution and \(F(q_p)=p\). For any integer \(k\) with \(1\le k\le n\), \(P\{X_{(k)}\le q_p\}=P\{N\ge k\}=\sum_{r=k}^n\binom{n}{r}p^r(1-p)^{n-r}\), and \(P\{q_p<X_{(k)}\}=P\{N\le k-1\}\).

To prove the event equivalence, \(X_{(k)}\le q_p\) holds precisely when at least \(k\) sample observations are at or below \(q_p\), which is the event \(N\ge k\). Its complement is \(N\le k-1\). The binomial formula follows by choosing which \(r\) of the \(n\) observations are at or below \(q_p\), then multiplying the independent probabilities \(p^r(1-p)^{n-r}\). Continuity gives \(P(X_i=q_p)=0\), so using “below” instead of “at or below” would not change the probability. \(\square\)

A bracket event is handled by imposing both count restrictions at once. For integers \(a<b\), the event \(X_{(a)}\le q_p<X_{(b)}\) is equivalent to \(a\le N\le b-1\). The first inequality requires at least \(a\) observations at or below \(q_p\); the second requires at most \(b-1\). Therefore its probability is the sum of the binomial probabilities over those allowed counts.

Worked Example: A Population Median Between Two Order Statistics

Take \(n=9\), and suppose \(q_{0.5}\) satisfies \(F(q_{0.5})=0.5\). Find the probability that the population median lies between the fifth and seventh order statistics, with the event written \(X_{(5)}\le q_{0.5}<X_{(7)}\).

The count \(N=N(q_{0.5})\) has distribution \(\operatorname{Binomial}(9,0.5)\). The left inequality requires \(N\ge5\), and the right inequality requires \(N\le6\). Thus only \(N=5\) and \(N=6\) contribute:

$$ \begin{aligned} P\{X_{(5)}\le q_{0.5}<X_{(7)}\} &=P(N=5)+P(N=6)\\ &=\binom{9}{5}(0.5)^5(0.5)^4 +\binom{9}{6}(0.5)^6(0.5)^3\\ &=\frac{126+84}{512} =\frac{210}{512} =\frac{105}{256} =0.41015625. \end{aligned} $$

The count range is the key check: \(N=4\) would put the fifth order statistic above the median, while \(N=7\) would put the seventh order statistic at or below it. Neither count satisfies the bracket.

Empirical-CDF Thresholds Use the Same Count

At a fixed \(t\), the empirical CDF is not a new source of randomness separate from the observations: it is the fraction \(N(t)/n\). If \(F(t)=p\), then \(N(t)\) is binomial with parameters \(n,p\). In particular, a threshold such as \(F_n(t)\ge c\) is equivalent to \(N(t)\ge\lceil nc\rceil\). The ceiling is needed because \(N(t)\) is integer-valued.

Worked Example: An Exact Empirical-CDF Tail Probability

Suppose \(n=10\) and a fixed \(t\) satisfies \(F(t)=0.3\). Calculate \(P\{F_n(t)\ge0.7\}\).

Since \(F_n(t)=N(t)/10\), the event requires \(N(t)\ge7\). Here \(N(t)\sim\operatorname{Binomial}(10,0.3)\), so

$$ \begin{aligned} P\{F_n(t)\ge0.7\} &=P\{N(t)\ge7\}\\ &=\sum_{r=7}^{10}\binom{10}{r}(0.3)^r(0.7)^{10-r}\\ &=0.0090016920+0.0014467005+0.0001377810+0.0000059049\\ &=0.0105920784. \end{aligned} $$

For comparison, the lower threshold \(F_n(t)\ge0.5\) would require \(N(t)\ge5\). Its terms are

$$ \begin{aligned} P\{F_n(t)\ge0.5\} &=P\{N(t)\ge5\}\\ &=0.1029193452+0.0367569090+0.0090016920\\ &\quad+0.0014467005+0.0001377810+0.0000059049\\ &=0.1502683326\approx0.1503. \end{aligned} $$

Each term uses the same success probability \(0.3\), and the sum includes every integer count satisfying the threshold, from 5 through 10. Keeping the binomial coefficients, powers, and count range visible makes an arithmetic check straightforward.

How to Set Up a Finite Exact Calculation

The following workflow applies to rank assignments, quantile brackets, and pointwise empirical-CDF thresholds. It is not a substitute for checking the model assumptions: it organizes the count only after the correct probability law has been identified.

1
Identify the sampling condition.
Check that observations are independent and identically distributed and that the distribution is continuous when the event uses ranks without ties.
2
Translate the event into a count.
Use permutations for fixed labels at fixed ranks. For a threshold \(t\), define \(N(t)\). For a quantile bracket, express each order-statistic inequality as an upper or lower bound on \(N(q_p)\).
3
Determine the integer range carefully.
Convert a CDF threshold using \(N(t)\ge\lceil nc\rceil\). For \(X_{(a)}\le q_p<X_{(b)}\), use \(a\le N(q_p)\le b-1\).
4
Sum the exact possibilities.
Add the probabilities of the allowed, disjoint counts or orderings. Check that no boundary count was omitted or included incorrectly.

Common Mistakes and Why These Calculations Matter

  • Using the wrong integer cutoff. Replacing \(F_n(t)\ge0.7\) by \(N(t)\ge6\) is incorrect when \(n=10\): the equivalent condition is \(N(t)\ge7\). Multiply the threshold by \(n\), then apply the ceiling.
  • Reversing an order-statistic condition. \(X_{(k)}\le q_p\) means at least \(k\) observations are at or below \(q_p\), not at most \(k\). Test the statement with a small count before summing.
  • Counting labels without counting completions. Fixing \(m\) labels at specified ranks leaves \((n-m)!\) ways to arrange the other labels; the probability is not generally \(1/n^m\).
  • Assuming all ranks are equally likely when ties can occur. The permutation argument requires a continuous common distribution, so ties have probability zero. With atoms, tie handling changes the event and the calculation.
  • Replacing \(F(q_p)\) by \(p\) without checking. The binomial success probability is \(F(q_p)\). It equals \(p\) under the stated quantile condition, but need not do so for every quantile convention or every distribution.

These calculations matter because exact finite-sample probabilities provide calibration without relying on large-sample approximations. A rank event is controlled by exchangeability, while a threshold event is controlled by a count of independent indicators. Recognizing which structure applies makes the probability both easier to calculate and easier to audit.

Key takeaway: Translate the event before calculating. Specified ranks lead to permutation counts; order-statistic brackets and empirical-CDF thresholds lead to integer ranges for a binomial count, provided the sampling and continuity conditions justify those laws.

Check Your Understanding

For each question, write the event as a permutation count or an integer count before evaluating it.

  1. For a sample of size 5 from a continuous common distribution, what is the probability that \(X_1\) is the smallest and \(X_4\) is the largest?
  2. If \(F(q_{0.4})=0.4\) and \(n=8\), what range of values of \(N(q_{0.4})\) is equivalent to \(X_{(2)}\le q_{0.4}<X_{(5)}\)?
  3. For \(n=12\), which integer values of \(N(t)\) correspond to \(F_n(t)\ge0.25\)?
  4. Why does the probability of a specified ordering of \(n\) labels equal \(1/n!\) under independent sampling from a continuous common distribution?
  5. What changes in the binomial calculation if \(F(q_p)\) is \(0.42\), even though the quantile is labelled with \(p=0.4\)?