Tutorials › Statistical Theory I - Probability and Distribution Theory › Ties, Midranks, and Continuous Rank Laws

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

Ties, Midranks, and Continuous Rank Laws

See how ties arise, assign their midranks precisely, and distinguish continuous-sample rank laws from the rank behavior of discrete observations.

Advanced 10 min read

What You'll Learn

  • State conditions under which sampled observations have no ties with probability one.
  • Calculate pairwise collision probabilities for discrete distributions.
  • Assign midranks to tied observations using their occupied rank positions.
  • Verify that midranks preserve the total sum of ranks.
  • Explain why discrete observations do not generally have uniform ranks.
  • Identify when continuous-sample rank probabilities are appropriate.

Why Ties Matter for Ranks

Ranks turn observed values into their relative positions in a sample. When all sampled values are distinct, each observation has one integer rank, and the sample can be arranged in a strict order. With ties, several observations share a value and occupy a block of positions. Their ranks then depend on the convention used to represent that block.

This distinction is not merely bookkeeping. Under independent sampling from a continuous distribution, ties have probability zero, which supports the usual continuous-sample rank laws. Discrete observations can tie with positive probability, so those laws do not automatically carry over. Rounding continuous measurements can also create ties in recorded data, even when the underlying measurements themselves come from a continuous distribution.

Definition: For a sample \(X_1,\ldots,X_n\), the ascending rank of an observation is its position when the sample is arranged from smallest to largest. If all values are distinct, the ranks are the integers \(1,\ldots,n\). If several observations have the same value, they occupy a block of positions; their midrank is the average of the positions in that block.

When Do Ties Have Probability Zero?

A distribution is atomless if \(P(X=x)=0\) for every real number \(x\). For a real-valued random variable, this is equivalent to having a continuous cumulative distribution function. A random variable can have a continuous distribution without having a density, so atomlessness—not the existence of a density—is the essential condition here.

Independence matters as well. If \(X_i\) and \(X_j\) are independent and \(X_j\) is atomless, then conditioning on \(X_i\) shows that their probability of equality is zero. The observation \(X_i\) may have any distribution in this argument. In particular, an independent sample from an atomless distribution has no ties almost surely.

Theorem: Let \(X_1,\ldots,X_n\) be independent real-valued random variables. If each \(X_i\) is atomless, then \(P(X_i=X_j)=0\) for every \(i\ne j\), and \(P(\text{at least one tie among }X_1,\ldots,X_n)=0\).

Proof. Fix \(i\ne j\). By independence, the joint distribution of \((X_i,X_j)\) is the product of their marginal distributions. Integrating the indicator of equality with respect to this product distribution gives

$$ P(X_i=X_j) =\int P(X_j=x)\,dF_i(x) =0, $$

because \(X_j\) is atomless, so \(P(X_j=x)=0\) for every \(x\). The event of at least one tie is the union of the pairwise equality events. There are only \(\binom{n}{2}\) such pairs, and each has probability zero; finite subadditivity therefore gives

$$ P\!\left(\bigcup_{1\le i<j\le n}\{X_i=X_j\}\right) \leq \sum_{1\le i<j\le n}P(X_i=X_j)=0. $$

Thus there are no ties with probability one. \(\square\)

Worked Example: No Ties in an Independent Uniform Sample

Let \(X_1,\ldots,X_5\) be independent \(U(0,1)\) observations. Each observation is atomless, so the theorem implies that the sample has no ties with probability one.

For a direct pairwise check, for any \(i\ne j\),

$$ P(X_i=X_j)=\int_0^1 P(X_j=x)\,dx =\int_0^1 0\,dx=0. $$

There are \(\binom{5}{2}=10\) pairs. The probability of any tie is at most the sum of the ten pairwise probabilities, which is zero. Hence all five ranks are distinct almost surely. This conclusion concerns ties in the random sample, not the chance that two simulated or recorded values are displayed identically after rounding.

Collision Probabilities and Discrete Samples

For discrete data, equality can have positive probability. If \(X_1\) and \(X_2\) are independent with the same discrete distribution and \(p_x=P(X_1=x)\), then

$$ P(X_1=X_2)=\sum_x p_x^2. $$

To see why, partition the equality event according to the common value \(x\). Independence gives \(P(X_1=x,X_2=x)=p_x^2\); summing these disjoint events gives the formula. It follows that two independent observations from a discrete distribution with at least one positive atom have a positive chance of tying.

Worked Example: Tie Probability for Two Bernoulli Observations

Let \(X_1,X_2\) be independent Bernoulli observations with \(P(X_i=1)=0.3\) and \(P(X_i=0)=0.7\). The only possible ties are that both observations are zero or both are one. Thus

$$ P(X_1=X_2) =P(X_1=X_2=0)+P(X_1=X_2=1) =(0.7)^2+(0.3)^2 =0.49+0.09=0.58. $$

So a tie occurs with probability \(0.58\), not zero. The complement consists of the two outcomes \((0,1)\) and \((1,0)\), each with probability \(0.7(0.3)=0.21\), giving \(P(X_1\ne X_2)=0.21+0.21=0.42\). The two probabilities sum to one.

Assigning Midranks

Suppose a tied group occupies positions \(a,a+1,\ldots,b\) in the sorted sample. Every observation in that group receives the average of those positions:

$$ R_{\mathrm{mid}}=\frac{a+(a+1)+\cdots+b}{b-a+1} =\frac{a+b}{2}. $$

This convention assigns the same rank to equal observations and places that rank at the center of their occupied block. Midranks can be integers or half-integers. They are not a claim that a tied observation occupies one uniquely identifiable position within the block.

Theorem: For any finite sample of size \(n\), assigning each tied group its midrank makes the sum of all assigned ranks equal to \(n(n+1)/2\), the sum of the untied ranks \(1,\ldots,n\).

Proof. Partition the sorted positions \(1,\ldots,n\) into the blocks occupied by distinct observed values. For a block from \(a\) through \(b\), let \(m=b-a+1\). Each of its \(m\) observations receives rank \((a+b)/2\), so the sum of assigned ranks within this block is

$$ m\frac{a+b}{2} =\frac{(b-a+1)(a+b)}{2} =\frac{b(b+1)-a(a-1)}{2} =\sum_{k=a}^{b}k. $$

The blocks partition all positions from 1 to \(n\). Summing their rank totals therefore gives \(\sum_{k=1}^{n}k=n(n+1)/2\), as required. \(\square\)

Worked Example: Midranks for a Sample With Two Tied Groups

Consider the sorted observations \(2,5,5,9,9,9\). The value 2 occupies position 1, so its rank is 1. The two observations equal to 5 occupy positions 2 and 3, and each receives

$$ \frac{2+3}{2}=2.5. $$

The three observations equal to 9 occupy positions 4, 5, and 6, so each receives

$$ \frac{4+6}{2}=5. $$

In the original observation order, if the sample was \((9,5,2,9,5,9)\), the midranks are \((5,2.5,1,5,2.5,5)\). Their sum is \(5+2.5+1+5+2.5+5=21\), which agrees with \(1+2+3+4+5+6=21\). The shared ranks record the ties; they do not recover a strict ordering among equal values.

Continuous Rank Laws and Their Limits

For independent, identically distributed observations from an atomless distribution, the joint sample is exchangeable: relabeling the observations does not change their joint distribution. Since there are no ties almost surely, every strict ordering of the labeled observations has the same probability. The \(n!\) possible orderings partition an event of probability one, so each has probability \(1/n!\). In particular, each observation's rank is uniform on \(\{1,\ldots,n\}\).

Both parts of that reasoning matter. Identical marginal distributions alone do not imply exchangeability; independence and identical distributions do imply it. Exchangeability is the symmetry used to compare the ordering probabilities, while atomlessness ensures that the sample has a strict ordering to begin with.

With discrete observations, exchangeability of an independent, identically distributed sample still holds, but ties can occur. The distinct strict-ordering events no longer cover the whole sample space. Midranks also need not be integers, and their distributions need not be uniform on \(\{1,\ldots,n\}\). Consequently, continuous-sample rank probabilities should not be used for discrete data without a separate argument that accounts for ties and the chosen rank convention.

Worked Example: A Discrete Midrank Is Not Uniform

Let \(X_1,X_2,X_3\) be independent Bernoulli observations with success probability \(0.3\). Assign ascending midranks and let \(R_1\) be the midrank of \(X_1\). If \(X_1=0\), then the possibilities for the other two observations give:

  • Both are 1, with conditional probability \(0.3^2=0.09\): \(X_1\) is alone in the lowest position and \(R_1=1\).
  • Exactly one is 1, with conditional probability \(2(0.3)(0.7)=0.42\): the two zeros occupy positions 1 and 2, so \(R_1=1.5\).
  • Both are 0, with conditional probability \(0.7^2=0.49\): all three observations tie and \(R_1=2\).

If \(X_1=1\), then:

  • Both other observations are 0, with conditional probability \(0.7^2=0.49\): \(R_1=3\).
  • Exactly one is 0, with conditional probability \(2(0.7)(0.3)=0.42\): the two ones occupy positions 2 and 3, so \(R_1=2.5\).
  • Both are 1, with conditional probability \(0.3^2=0.09\): all three observations tie and \(R_1=2\).

Multiplying by \(P(X_1=0)=0.7\) or \(P(X_1=1)=0.3\) gives the unconditional distribution:

$$ \begin{aligned} P(R_1=1)&=0.7(0.09)=0.063,\\ P(R_1=1.5)&=0.7(0.42)=0.294,\\ P(R_1=2)&=0.7(0.49)+0.3(0.09)=0.370,\\ P(R_1=2.5)&=0.3(0.42)=0.126,\\ P(R_1=3)&=0.3(0.49)=0.147. \end{aligned} $$

These probabilities sum to \(0.063+0.294+0.370+0.126+0.147=1\). The rank is not uniform on \(\{1,2,3\}\): it can take the half-integer values 1.5 and 2.5, and \(P(R_1=1)=0.063\), not \(1/3\). This example shows directly why a continuous-sample rank law cannot simply be applied to discrete observations.

Common Pitfall and Practical Interpretation

Wrong reasoning: “The observations have the same distribution, so their ranks are uniformly distributed just as in a continuous sample.” Identical marginals by themselves do not even guarantee that the joint sample is exchangeable. And even for independent, identically distributed discrete observations—which are exchangeable—ties mean the raw midranks do not form a permutation of \(1,\ldots,n\).

Correction: Check the sampling assumptions and the tie behavior separately. Independent, identically distributed observations are exchangeable, but a discrete distribution may produce ties with positive probability. State the rank convention, such as midranks, and derive or calculate the resulting rank probabilities under the actual sampling distribution. If measurements were rounded, analyze the recorded values using their tie structure rather than silently treating them as an untied continuous sample.

The distinction matters in rank-based procedures because their reference probabilities may rely on all orderings being equally likely and on there being no ties. A procedure may still be adapted for discrete or tied data, but its calibration must account for the actual distribution of the ranks—for example, through a suitable exact calculation or a method designed for ties. The continuous-sample result is not a universal property of ranks; it is a consequence of specific assumptions.

Key takeaway: Independent atomless observations have no ties almost surely. When ties do occur, midranks average the positions in each tied block and preserve the total rank sum. Continuous-sample rank probabilities require their own assumptions and generally do not describe discrete midranks.

Check Your Understanding

Use the definitions and results above to answer these questions.

  1. Why does independence together with atomlessness imply that two observations have probability zero of being equal?
  2. For two independent observations with probabilities \(P(X=0)=0.4\) and \(P(X=1)=0.6\), calculate the probability of a tie.
  3. A tied group occupies positions 3 through 6. What midrank is assigned to each observation in the group?
  4. Explain why midranks preserve the total rank sum even when several tied groups occur.
  5. Why does exchangeability of an independent, identically distributed discrete sample not by itself imply that each observation's midrank is uniform on \(\{1,\ldots,n\}\)?