Tutorials › Statistical Theory I - Probability and Distribution Theory › The Distribution of the Sample Range

Order Statistics and Sample Extremes · Tutorial 463 of 994

The Distribution of the Sample Range

Learn to calculate range probabilities, densities, and expectations by transforming the joint distribution of the sample extremes.

Intermediate 10 min read

What You'll Learn

  • Define the sample range and identify the assumptions behind its continuous distribution.
  • Derive the range CDF from the joint density of the sample minimum and maximum.
  • Obtain the range density and interpret its support.
  • Calculate probabilities and expectations for uniform and exponential samples.
  • Use the tail-integral formula to evaluate the expected range.
  • Recognize why maximum and minimum cannot generally be treated as independent.

Why the Range Has Its Own Distribution

The sample range is the distance between the largest and smallest observations. It is a simple measure of spread, but its distribution depends on both extremes jointly: a large maximum alone does not determine whether the range is large, since the minimum may also be large. Starting from the joint law of the extremes gives a direct way to calculate range probabilities and expectations.

Throughout the main derivation, let \(X_1,\ldots,X_n\) be independent and identically distributed random variables with an absolutely continuous distribution function \(F\) and density \(f\), where \(n\geq 2\). Write \(X_{(1)}=\min_i X_i\) and \(X_{(n)}=\max_i X_i\).

Definition: The sample range is $$ R_n=X_{(n)}-X_{(1)}. $$ It is nonnegative. Under the stated continuous sampling assumptions, ties occur with probability zero, so \(R_n>0\) with probability one when \(n\geq 2\).

From the Joint Extreme-Value Law to the Range CDF

For an IID sample with density \(f\), the joint density of \(X_{(1)}\) and \(X_{(n)}\) is

$$ f_{X_{(1)},X_{(n)}}(x,y) =n(n-1)f(x)f(y)\{F(y)-F(x)\}^{n-2},\qquad x<y. $$

The factor \(n(n-1)\) selects which observation is the minimum and which is the maximum. Each remaining observation must lie between \(x\) and \(y\), an event with probability \(F(y)-F(x)\). This density is zero outside \(x<y\).

To obtain the range distribution, use \(R_n=y-x\). For a fixed minimum \(x\), a range of at most \(r\) means the maximum lies between \(x\) and \(x+r\). The resulting CDF and density follow from integrating the joint density over that region and changing variables from \(y\) to \(r=y-x\).

Theorem: For \(r<0\), \(P(R_n\leq r)=0\). For \(r\geq0\), $$ P(R_n\leq r) =n\int_{-\infty}^{\infty} f(x)\{F(x+r)-F(x)\}^{n-1}\,dx. $$ For \(r>0\), a density of \(R_n\) is $$ f_{R_n}(r) =n(n-1)\int_{-\infty}^{\infty} f(x)f(x+r)\{F(x+r)-F(x)\}^{n-2}\,dx. $$

To verify the CDF formula, integrate the joint density over \(x<y\leq x+r\), and set \(t=y-x\). The Jacobian of this transformation is one. Thus

$$ \begin{aligned} P(R_n\leq r) &=n(n-1)\int_{-\infty}^{\infty} f(x) \int_0^r f(x+t)\{F(x+t)-F(x)\}^{n-2}\,dt\,dx\\ &=n\int_{-\infty}^{\infty} f(x) \{F(x+r)-F(x)\}^{n-1}\,dx. \end{aligned} $$

For the second equality, the derivative with respect to \(t\) of \(\{F(x+t)-F(x)\}^{n-1}\) is \((n-1)f(x+t)\{F(x+t)-F(x)\}^{n-2}\) for almost every \(t\). The fundamental theorem for absolutely continuous functions evaluates the inner integral. The density formula follows from the same change of variables: the joint density of \((X_{(1)},R_n)\) at \((x,r)\) is the joint extreme-value density at \((x,x+r)\). Integrating it over \(x\) gives the displayed marginal density. These integrations are valid for nonnegative integrands by Tonelli’s theorem. \(\square\)

The CDF formula also has a useful interpretation: choose which observation is the minimum, place it near \(x\), and require all other observations to fall in \([x,x+r]\). The integral sums over all possible minimum values. This interpretation can make the formula easier to remember than the density.

Worked Examples

Worked Example: The Range of a Uniform Sample

Let \(X_1,\ldots,X_4\) be IID uniform on \([0,1]\). Find the CDF and density of \(R_4\), calculate \(P(R_4\leq 1/2)\), and find \(E[R_4]\).

Here \(f(x)=1\) and \(F(x)=x\) on \([0,1]\), with \(F(x)=0\) below 0 and \(F(x)=1\) above 1. In the CDF integral, \(x\) ranges from 0 to 1. If \(0\leq x\leq1-r\), then \(F(x+r)-F(x)=r\); if \(1-r<x\leq1\), that difference is \(1-x\). For \(0\leq r\leq1\),

$$ \begin{aligned} P(R_4\leq r) &=4\left\{\int_0^{1-r}r^3\,dx+\int_{1-r}^1(1-x)^3\,dx\right\}\\ &=4\left\{(1-r)r^3+\frac{r^4}{4}\right\} =4r^3-3r^4. \end{aligned} $$

The CDF is zero for \(r<0\) and one for \(r\geq1\). Differentiating on \(0<r<1\) gives \(f_{R_4}(r)=12r^2(1-r)\). At \(r=1/2\),

$$ P(R_4\leq 1/2)=4(1/2)^3-3(1/2)^4 =\frac{1}{2}-\frac{3}{16}=\frac{5}{16}. $$

Finally, \(E[R_4]=\int_0^1 r f_{R_4}(r)\,dr\), so

$$ E[R_4]=12\int_0^1(r^3-r^4)\,dr =12\left(\frac14-\frac15\right)=\frac35. $$

The range is bounded by 1, as it must be, and the calculated expectation \(3/5\) lies within that bound.

Worked Example: The Range of an Exponential Sample

Let \(X_1,\ldots,X_4\) be IID exponential random variables with rate \(\lambda>0\), so \(f(x)=\lambda e^{-\lambda x}\) for \(x\geq0\) and \(F(x)=1-e^{-\lambda x}\). Find the CDF, calculate a range probability, and find the expected range.

For \(x\geq0\), \(F(x+r)-F(x)=e^{-\lambda x}(1-e^{-\lambda r})\). The CDF formula therefore gives, for \(r\geq0\),

$$ \begin{aligned} P(R_4\leq r) &=4\int_0^\infty \lambda e^{-\lambda x} \left[e^{-\lambda x}(1-e^{-\lambda r})\right]^3\,dx\\ &=4\lambda(1-e^{-\lambda r})^3 \int_0^\infty e^{-4\lambda x}\,dx\\ &=(1-e^{-\lambda r})^3. \end{aligned} $$

At \(r=(\log 2)/\lambda\), \(e^{-\lambda r}=1/2\), and hence \(P(R_4\leq r)=(1/2)^3=1/8\). Differentiating the CDF gives \(f_{R_4}(r)=3\lambda e^{-\lambda r}(1-e^{-\lambda r})^2\) for \(r>0\).

For a nonnegative random variable, its expectation is the area under its survival probability: \(E[R_4]=\int_0^\infty P(R_4>r)\,dr\), allowing the value \(+\infty\). Here,

$$ \begin{aligned} E[R_4] &=\int_0^\infty\{1-(1-e^{-\lambda r})^3\}\,dr\\ &=\frac{1}{\lambda}\int_0^1\frac{1-(1-u)^3}{u}\,du =\frac{1}{\lambda}\int_0^1(3-3u+u^2)\,du =\frac{11}{6\lambda}, \end{aligned} $$

where \(u=e^{-\lambda r}\), so \(dr=-du/(\lambda u)\), with the limits reversed. The integral is finite, confirming that this unbounded parent distribution still gives a finite expected range.

Worked Example: Two Normal Observations

Let \(X_1,X_2\) be IID \(N(\mu,\sigma^2)\), with \(\sigma>0\). Find the CDF of their range and calculate its expected value.

With two observations, \(R_2=|X_2-X_1|\). The difference of these independent normal variables has distribution \(X_2-X_1\sim N(0,2\sigma^2)\). If \(\Phi\) denotes the standard normal CDF, then for \(r\geq0\),

$$ \begin{aligned} P(R_2\leq r) &=P(-r\leq X_2-X_1\leq r)\\ &=\Phi\left(\frac{r}{\sqrt{2}\sigma}\right) -\Phi\left(-\frac{r}{\sqrt{2}\sigma}\right) =2\Phi\left(\frac{r}{\sqrt{2}\sigma}\right)-1. \end{aligned} $$

In particular, at \(r=\sigma\), the probability is \(2\Phi(1/\sqrt2)-1\), approximately \(0.5205\). The density of the absolute value of this centered normal difference is \(f_{R_2}(r)=\frac{1}{\sigma\sqrt{\pi}}e^{-r^2/(4\sigma^2)}\) for \(r>0\). Therefore,

$$ \begin{aligned} E[R_2] &=\frac{1}{\sigma\sqrt{\pi}}\int_0^\infty r e^{-r^2/(4\sigma^2)}\,dr\\ &=\frac{1}{\sigma\sqrt{\pi}}\,(2\sigma^2) =\frac{2\sigma}{\sqrt{\pi}}. \end{aligned} $$

For the integral, the substitution \(v=r^2/(4\sigma^2)\) gives \(r\,dr=2\sigma^2\,dv\) and \(\int_0^\infty e^{-v}\,dv=1\). The mean \(\mu\) cancels because adding the same location shift to both observations does not change their difference.

Expected Range and Tail Probabilities

The tail-integral formula used above is not limited to these examples. For any nonnegative random variable \(W\), the identity \(W=\int_0^\infty \mathbf{1}\{W>r\}\,dr\) holds pointwise. Taking expectations and applying Tonelli’s theorem to the nonnegative integrand gives

Theorem: For any nonnegative random variable \(W\), $$ E[W]=\int_0^\infty P(W>r)\,dr, $$ where either side is allowed to be infinite. In particular, this applies to the sample range \(R_n\).

For a bounded parent distribution supported on \([a,b]\), the range satisfies \(0\leq R_n\leq b-a\), so its expectation is finite and the tail integral only needs to run to \(b-a\). For an unbounded parent distribution, the same identity applies, but finiteness must be checked from the tail. For example, the exponential calculation above showed directly that the expected range is finite.

Common Mistake: Treating the Extremes as Independent

A tempting but incorrect approach is to calculate the distribution of the maximum and the minimum separately, then multiply probabilities as if they were independent. They are generally dependent: a very large minimum leaves less room for the maximum to create a large range. The joint extreme-value density accounts for this dependence and is why the range CDF involves \(F(x+r)-F(x)\), not just a marginal CDF evaluated at \(r\).

A second warning is about assumptions. The displayed density formulas require an absolutely continuous parent distribution. Discrete samples can have ties and a range distribution with point masses; applying a continuous density formula to such a sample can miss probability at those atoms. When continuity holds, the formula provides both a CDF for direct probability calculations and, where needed, a density for integration.

Check Your Understanding

Use the range formulas and assumptions developed above.

  1. For \(n\geq2\), why does the CDF formula integrate over all possible values of the sample minimum?
  2. For an IID uniform sample on \([0,1]\) of size 3, use the derived CDF to calculate \(P(R_3\leq1/2)\).
  3. For an IID exponential sample with rate \(\lambda\), what is the CDF of the range for general \(n\geq2\)?
  4. Explain why the sample range is bounded when the parent distribution is supported on a finite interval, even though the sample size may be large.
  5. What feature of a discrete sample prevents the continuous range-density formula from being applied without adjustment?