Tutorials › Statistical Theory I - Probability and Distribution Theory › Rank Variables Under Continuous Sampling

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

Rank Variables Under Continuous Sampling

Learn to define an observation’s ascending rank, calculate it directly from comparisons, and verify the basic identities satisfied by all ranks in a tie-free sample.

Advanced 10 min read

What You'll Learn

  • Define the ascending rank of a specified observation in an iid continuous sample
  • Express a rank as one plus the count of smaller observations
  • Explain why independent observations from a continuous distribution have no ties with probability one
  • Connect each observation’s rank to its position among the order statistics
  • Verify the permutation and sum identities for realized ranks
  • Avoid common off-by-one and rank-versus-order-statistic errors

Why Ranks Begin With Comparisons

An order statistic tells us the value in a particular sorted position; a rank tells us where a particular observation falls in that ordering. These are two ways to describe the same sorted sample, but they answer different questions. If a laboratory records measurements \(X_1,\ldots,X_n\), the rank of \(X_i\) identifies its position relative to the other measurements, without requiring a new distribution model for the measurement scale.

The key calculation is simple: count the observations smaller than the one of interest, then add one for the observation itself. In an iid sample from a continuous distribution, ties occur with probability zero, so this comparison-based definition gives an unambiguous position almost surely.

Definition and Basic Notation

Let \(X_1,\ldots,X_n\) be iid random variables with a continuous distribution function \(F\). Write the sample in increasing order as \(X_{(1)}\leq\cdots\leq X_{(n)}\). The subscript \(i\) identifies an observation in the original sample, while the subscript \(r\) in \(X_{(r)}\) identifies a position in the sorted sample.

Definition: On the event that the sample values are distinct, the ascending rank of observation \(X_i\) is $$ R_i=1+\sum_{\substack{j=1\\j\ne i}}^n \mathbf{1}\{X_j<X_i\}, $$ where \(\mathbf{1}\{A\}\) equals 1 when \(A\) occurs and 0 otherwise. Thus rank 1 is the smallest observation, and rank \(n\) is the largest.

The quantity \(R_i\) is a random variable because it depends on the random sample. After values are observed, its realized value is an integer from 1 to \(n\). The rank is attached to the original observation label \(i\); the order statistic \(X_{(r)}\) is the value occupying sorted position \(r\).

Worked Example: Ranking One Exponential Observation

Suppose six observed measurements from an iid exponential model with rate 1 are \(0.42, 1.80, 0.15, 0.91, 2.30, 0.66\), in that sample order. Find the rank of \(X_4=0.91\).

Compare \(0.91\) with each of the other five values. The values below it are \(0.42\), \(0.15\), and \(0.66\); the values above it are \(1.80\) and \(2.30\). There are three observations below \(X_4\), so $$ R_4=1+3=4. $$

As a check, sorting the values gives \(0.15, 0.42, 0.66, 0.91, 1.80, 2.30\). The fourth sorted value is indeed \(X_4\). The model specifies the sampling context; the rank calculation itself uses only the observed comparisons.

Why Continuous Sampling Avoids Ties

The definition above uses strict comparisons. To see why it applies cleanly under the stated sampling conditions, first establish that distinct sample observations are unequal with probability one. Continuity of \(F\) means that every singleton has probability zero: \(P(X_i=x)=0\) for each fixed \(x\).

Theorem: If \(X_1,\ldots,X_n\) are independent and each has a continuous distribution, then $$ P(\text{there is a tie among }X_1,\ldots,X_n)=0. $$

Proof. Fix two different indices \(i\) and \(j\). Independence gives the product distribution for \((X_i,X_j)\). Integrating the indicator of the diagonal \(\{(x,y):x=y\}\) with respect to this product distribution yields $$ P(X_i=X_j) =\int\!\!\int \mathbf{1}\{x=y\}\,dF_i(x)\,dF_j(y) =\int F_j(\{x\})\,dF_i(x) =0, $$ because \(F_j(\{x\})=0\) for every \(x\). There are only \(\binom{n}{2}\) pairs of indices. By the union bound, $$ P(\text{at least one tied pair}) \leq \sum_{1\leq i<j\leq n}P(X_i=X_j) =0. $$ Therefore the sample has no ties with probability one. \(\square\)

This result needs independence as well as continuous marginal distributions. Continuous marginals alone do not rule out ties: for example, if \(X_2=X_1\) by construction and \(X_1\) has a continuous distribution, each variable has a continuous marginal distribution, but they are always tied.

Ranks and the Sorted Sample

Once a sample has no ties, every observation occupies exactly one position in its sorted list. The comparison formula identifies that position directly: if exactly \(r-1\) observations are smaller than \(X_i\), then \(X_i\) is the \(r\)th sorted value.

Theorem: For a sample of \(n\) distinct real values, the ranks \(R_1,\ldots,R_n\) are exactly the integers \(1,\ldots,n\), each appearing once. Moreover, \(R_i=r\) if and only if \(X_i=X_{(r)}\), and $$ \sum_{i=1}^n R_i=\frac{n(n+1)}{2}. $$

Proof. Sort the distinct values as \(X_{(1)}<\cdots<X_{(n)}\). Exactly \(r-1\) sample values are smaller than \(X_{(r)}\), so the comparison definition assigns that observation rank \(1+(r-1)=r\). Each observation appears once in the sorted list, so each rank from 1 through \(n\) appears once and no other rank appears. This also gives \(R_i=r\) exactly when \(X_i=X_{(r)}\). Summing the ranks therefore gives $$ \sum_{i=1}^n R_i=1+2+\cdots+n=\frac{n(n+1)}{2}, $$ using the formula for the sum of the first \(n\) positive integers. \(\square\)

Worked Example: Checking Every Rank in a Normal Sample

Suppose five observations from an iid \(N(0,1)\) sample are \(X_1=1.2\), \(X_2=-0.4\), \(X_3=0.7\), \(X_4=1.8\), and \(X_5=0.1\). Calculate the rank of each observation from comparisons.

For \(X_1=1.2\), the smaller values are \(-0.4, 0.7, 0.1\), so \(R_1=1+3=4\). For \(X_2=-0.4\), no value is smaller, so \(R_2=1\). For \(X_3=0.7\), the smaller values are \(-0.4\) and \(0.1\), giving \(R_3=3\). For \(X_4=1.8\), all four other values are smaller, giving \(R_4=5\). For \(X_5=0.1\), only \(-0.4\) is smaller, giving \(R_5=2\).

In the original observation order, the rank vector is \((4,1,3,5,2)\). It contains each integer from 1 to 5 once, and its sum is \(4+1+3+5+2=15=5(6)/2\), as required. Sorting the values gives \(-0.4,0.1,0.7,1.2,1.8\), which confirms the same assignments.

Counting Comparisons Without Sorting

For a single specified observation, it is often unnecessary to sort the whole sample. Its rank can be found by checking only which other values fall below it. This is especially useful when a problem supplies comparisons or threshold counts rather than a fully ordered list.

Worked Example: Finding a Rank From a Comparison Table

Seven observations from an iid \(\operatorname{Uniform}(0,1)\) sample are recorded as \(X_1=0.12\), \(X_2=0.73\), \(X_3=0.48\), \(X_4=0.91\), \(X_5=0.66\), \(X_6=0.31\), and \(X_7=0.05\). Find \(R_2\) by comparing \(X_2\) with the remaining observations.

The observations smaller than \(0.73\) are \(0.12\), \(0.48\), \(0.66\), \(0.31\), and \(0.05\), for a total of five. The only value greater than \(0.73\) is \(0.91\). Therefore $$ R_2=1+\sum_{\substack{j=1\\j\ne 2}}^7\mathbf{1}\{X_j<0.73\} =1+5=6. $$

The sorted values are \(0.05,0.12,0.31,0.48,0.66,0.73,0.91\), so \(X_2\) occupies position 6. The comparison count and the sorted-list check agree.

The same calculation can be written in terms of observations above \(X_i\). With no ties, exactly \(n-1\) other observations are either below or above \(X_i\). If \(A_i=\sum_{j\ne i}\mathbf{1}\{X_j>X_i\}\) is the number above it, then $$ R_i=1+(n-1-A_i)=n-A_i. $$ This alternative is useful when the number of larger observations is easier to count. It also provides a quick check: an observation with no values above it has rank \(n\), as it should.

Common Mistakes and a Key Distinction

  • Forgetting the observation itself. The number of values strictly below \(X_i\) is \(R_i-1\), not \(R_i\). Add one to obtain the rank.
  • Confusing sample label with rank. The index \(i\) records where an observation appeared in the original sample; it does not indicate its sorted position. In the normal example, observation \(X_2\) had rank 1.
  • Confusing rank with an order statistic. \(R_i\) is an integer position, while \(X_{(r)}\) is a sample value. The statement \(R_i=r\) means that \(X_i\) is the value \(X_{(r)}\).
  • Assuming continuous marginals alone prevent ties. Independence is part of the no-ties result. Dependence can force two observations to be equal even when each marginal distribution is continuous.
  • Assuming a rank assignment is automatically equally likely among all possibilities. The deterministic fact that the ranks are \(1,\ldots,n\) once each does not, by itself, establish probabilities for different rank assignments.
Key takeaway: In a tie-free sample, the ascending rank of \(X_i\) is one plus the number of other observations below it. Every observation gets one distinct rank, and the ranks sum to \(n(n+1)/2\).

Check Your Understanding

Use the comparison definition and the tie-free rank identities to answer these questions.

  1. In a sample of six distinct values, exactly four observations are below \(X_i\). What is \(R_i\), and how many observations are above \(X_i\)?
  2. Explain why the sample index \(i\) does not generally equal the rank \(R_i\).
  3. For distinct values, why must two different observations have different ranks?
  4. What assumptions ensure that an iid sample has no ties with probability one? Give an example showing why continuous marginals alone are insufficient.
  5. If the ranks in a sample of size \(n\) have been calculated, what sum should they produce? State the identity and explain its basis.