From a Sample Quantile to an Order Statistic
A sample quantile is a random variable: different samples generally produce different values. Its exact distribution depends on which sample-quantile convention is used. Under the empirical generalized-inverse convention, the quantile is one of the ordered observations, so its law can be obtained from the law of an order statistic.
Let \(X_1,\ldots,X_n\) be independent and identically distributed (iid) observations with CDF \(F\), and write their ordered values as \(X_{(1)}\leq \cdots \leq X_{(n)}\). The empirical CDF is \(F_n(x)=n^{-1}\sum_{i=1}^n \mathbf{1}\{X_i\leq x\}\). We use the empirical quantile defined by its generalized inverse.
Indeed, the empirical CDF first reaches or exceeds \(p\) at the \(k\)th ordered observation, since \(F_n(X_{(k)})\geq k/n\geq p\), while fewer than \(k\) observations are at or below any value strictly smaller than \(X_{(k)}\). For a continuous population CDF, ties occur with probability zero, so this description applies almost surely.
The index matters. For example, when \(n\) is even, the arithmetic average of the two middle observations is a common median convention, but it is generally not an order statistic. The exact law derived here applies directly to the stated generalized-inverse convention, and to any other sample quantile that is explicitly defined as \(X_{(k)}\).
The Beta Law on the Probability Scale
The key simplification is to put observations on the probability scale. If \(F\) is continuous, then \(F(X_i)\) is uniform on \((0,1)\). Since \(F\) is nondecreasing, ordering the observations also orders their transformed values. The resulting order statistic has a beta distribution.
Here \(\operatorname{Beta}(a,b)\), for positive \(a,b\), has density proportional to \(u^{a-1}(1-u)^{b-1}\) on \(0<u<1\), with normalizing constant \(1/B(a,b)\), where \(B(a,b)=\int_0^1 u^{a-1}(1-u)^{b-1}\,du\). Thus \(I_u(a,b)=B(a,b)^{-1}\int_0^u v^{a-1}(1-v)^{b-1}\,dv\) for \(0\leq u\leq 1\).
For continuous \(F\), set \(U_i=F(X_i)\). The probability integral transform gives iid \(U_i\sim\operatorname{Uniform}(0,1)\). This remains true if \(F\) is constant on some intervals: such intervals carry zero probability, so they do not create atoms in \(F(X_i)\).
Because \(F\) is nondecreasing, \(F(X_{(k)})=U_{(k)}\), where \(U_{(k)}\) is the \(k\)th order statistic of the transformed sample.
The joint density of the ordered uniform sample is \(n!\) on \(0<u_1<\cdots<u_n<1\). Holding \(u_k=u\), the volume available for the \(k-1\) values below \(u\) is \(u^{k-1}/(k-1)!\); the volume for the \(n-k\) values above \(u\) is \((1-u)^{n-k}/(n-k)!\). Multiplying these volumes by \(n!\) gives \( f_{U_{(k)}}(u)=\frac{n!}{(k-1)!(n-k)!}u^{k-1}(1-u)^{n-k} \) for \(0<u<1\).
The displayed density is that of \(\operatorname{Beta}(k,n+1-k)\), since \(B(k,n+1-k)=(k-1)!(n-k)!/n!\). Therefore \(F(X_{(k)})\) has this beta law.
To complete the CDF statement, continuity of \(F\) gives \(P(X_{(k)}\leq x)=P(U_{(k)}\leq F(x))\). If \(F\) has a flat interval, its endpoints can differ in the original sample space while having the same \(F\)-value, but the interval has probability zero; the equality of probabilities still holds. The CDF of \(U_{(k)}\) is \(I_u(k,n+1-k)\), proving the result. \(\square\)
The proof also explains what “exact distribution” means when the sample comes from a continuous CDF that has no density. The order statistic still has the CDF in the theorem; no density for \(X_{(k)}\) is required.
Exact Distributions for Sample Quantiles
Under the empirical generalized-inverse convention, substitute \(k=\lceil np\rceil\) into the theorem. In particular, the probability-scale sample quantile has a beta law, and the CDF on the original measurement scale is obtained by evaluating that beta CDF at \(F(x)\).
If \(F\) is strictly increasing, the original-scale distribution can also be written using its inverse: for \(0<u<1\), the corresponding quantile value is \(F^{-1}(u)\), where \(F^{-1}\) is the ordinary inverse function. In that case, the sample quantile is the inverse transformation of a beta random variable. If \(F\) is not strictly increasing, the CDF formula above remains valid, while an ordinary inverse need not exist.
Worked Example: A Lower Quartile from a Uniform Sample
Let \(X_1,\ldots,X_8\) be iid \(\operatorname{Uniform}(0,1)\). Find the exact distribution of the empirical generalized-inverse 25th percentile, and calculate the probability that it is at most \(1/2\).
The order-statistic index is \(k=\lceil 8(0.25)\rceil=\lceil2\rceil=2\), so \(\hat q_{0.25}=X_{(2)}\). Because \(F(x)=x\) for \(0\leq x\leq1\), the theorem gives \(\hat q_{0.25}\sim\operatorname{Beta}(2,7)\). Its density is \( f_{\hat q_{0.25}}(x)=56x(1-x)^6 \), \(0<x<1\), since \(8!/(1!6!)=56\).
An antiderivative of this density that starts at zero is \(1-(1-x)^7(1+7x)\): differentiating gives \(56x(1-x)^6\). Therefore \( P(\hat q_{0.25}\leq 1/2)=1-(1/2)^7(1+7/2)=1-(1/128)(9/2)=247/256 \). The probability is approximately \(0.965\).
Worked Example: The Median of Five Normal Observations
Let \(X_1,\ldots,X_5\) be iid \(N(\mu,\sigma^2)\), with \(\sigma>0\). Under the empirical generalized-inverse convention, the sample median is \(X_{(3)}\). Determine its exact CDF and its probability of falling below \(\mu\).
For the normal CDF \(F(x)=\Phi((x-\mu)/\sigma)\), the theorem says \(F(X_{(3)})\sim\operatorname{Beta}(3,3)\). The beta density is \(30u^2(1-u)^2\) on \((0,1)\). Integrating, its CDF is \(10u^3-15u^4+6u^5\), whose derivative is \(30u^2(1-u)^2\). Consequently, \( P(X_{(3)}\leq x)=10F(x)^3-15F(x)^4+6F(x)^5 \).
At \(x=\mu\), \(F(\mu)=1/2\). Substitution gives \( P(X_{(3)}\leq\mu)=10/8-15/16+6/32=1/2 \). This matches the symmetry of the sample about \(\mu\); the calculation also supplies the full exact CDF, not just that one probability.
Worked Example: An Exponential Sample Quantile
Let \(X_1,\ldots,X_4\) be iid exponential with rate \(2\), so \(F(x)=1-e^{-2x}\) for \(x\geq0\). Find the exact CDF of the empirical generalized-inverse median \(X_{(2)}\), and evaluate it at \(x=(\log 2)/2\).
Here \(k=\lceil4(0.5)\rceil=2\), and \(F(X_{(2)})\sim\operatorname{Beta}(2,3)\). The beta density is \(12u(1-u)^2\). Its CDF is \(6u^2-8u^3+3u^4\), as differentiation verifies. Thus for \(x\geq0\), \( P(X_{(2)}\leq x)=6(1-e^{-2x})^2-8(1-e^{-2x})^3+3(1-e^{-2x})^4 \).
At \(x=(\log 2)/2\), \(e^{-2x}=1/2\), so \(F(x)=1/2\). The probability is \(6(1/4)-8(1/8)+3(1/16)=3/2-1+3/16=11/16\). For \(x<0\), the CDF is zero, as the exponential observations are nonnegative.
When the Original-Scale Quantile Has a Density
The beta result gives an exact CDF even when the population distribution has no density. If \(F\) is absolutely continuous with density \(f\), the original-scale order statistic also has a density, given almost everywhere by \( f_{X_{(k)}}(x)=\frac{n!}{(k-1)!(n-k)!}F(x)^{k-1}\{1-F(x)\}^{n-k}f(x) \).
To see why, differentiate the CDF \(I_{F(x)}(k,n+1-k)\) at points where \(F\) is differentiable, using the chain rule and \(F'(x)=f(x)\) almost everywhere. The beta density contributes the factor in \(F(x)\) and \(1-F(x)\); multiplying by \(f(x)\) gives the stated expression. Absolute continuity is important here: for a continuous CDF without a density, the CDF result remains true, but this density formula need not apply.
Common Mistake and Why the Result Matters
A frequent mistake is to say that a sample \(p\)-quantile has a \(\operatorname{Beta}(np,n+1-np)\) distribution. This is generally wrong: the beta parameters are determined by the integer order-statistic index \(k=\lceil np\rceil\), not by the possibly noninteger number \(np\). For instance, when \(n=5\) and \(p=0.5\), the empirical generalized-inverse quantile is \(X_{(3)}\), so its probability-scale law is \(\operatorname{Beta}(3,3)\), not a beta law with noninteger parameters \(2.5\) and \(3.5\).
Another error is to treat an interpolated sample quantile as if it were a single order statistic. If a convention averages two adjacent order statistics, its distribution is the distribution of that average; the beta result for either order statistic alone does not give that law. Always identify the sample-quantile convention before applying an exact-distribution formula.
The result is useful because it separates rank from measurement scale. Once \(n\) and \(k\) are fixed, the transformed quantile \(F(\hat q_p)\) has the same beta distribution for every continuous population model. The original-scale distribution changes with \(F\), but its CDF follows from one substitution, \(u=F(x)\). This gives an exact reference law for a chosen sample quantile without approximating its sampling distribution.
Check Your Understanding
Use the order-statistic index and the probability-scale beta law to answer these questions.
- For \(n=12\) and \(p=0.4\), what order statistic is the empirical generalized-inverse \(p\)-quantile, and what are the two beta parameters of its transformed value?
- For iid observations from a continuous CDF \(F\), write the exact CDF of \(X_{(k)}\) using \(I_u(a,b)\).
- For a continuous CDF with a flat interval, does the beta law for \(F(X_{(k)})\) still hold? Explain why the absence of a density does not invalidate the CDF result.
- Why does the beta distribution of \(F(\hat q_p)\) not by itself specify the numerical distribution of \(\hat q_p\) on the original measurement scale?
- When \(n\) is even, why might the arithmetic-average sample median require a different distributional calculation from the one for \(X_{(n/2)}\)?