2.2 Confidence Interval for the Median
The sign test decides whether a hypothesised median is tenable. Inverting it — collecting the values that would not be rejected — gives a confidence interval, and because the sign test assumes nothing about the shape of the distribution, neither does the interval.
Definition 2.13. Let \(X_{(1)} \leq \cdots \leq X_{(n)}\) be the order statistics of a sample from a continuous distribution with median \(\theta \). For an integer \(k\) with \(1 \leq k < \tfrac {n}{2}\), the interval \[\left (M_L,\ M_U\right ) = \left (X_{(k)},\ X_{(n+1-k)}\right )\] is the sign-test confidence interval for \(\theta \), with \(M_L\) the lower and \(M_U\) the upper limit.
Theorem 2.14. \[P\left (X_{(k)} < \theta < X_{(n+1-k)}\right ) = 1 - 2\,P\!\left (\text {Bin}\!\left (n,\tfrac 12\right ) \leq k-1\right ).\]
Proof. The interval fails on the left exactly when \(\theta \leq X_{(k)}\), that is when at most \(k-1\) of the observations fall below \(\theta \). Each observation lies below the median with probability \(\tfrac 12\) independently, so that event has probability \(P\left (\text {Bin}(n,\tfrac 12) \leq k-1\right )\). By symmetry the right-hand failure has the same probability, and the two cannot occur together. □
Note 2.15. The coverage depends only on \(n\) and \(k\) — never on the distribution — which is what makes the interval distribution-free. It also means the attainable levels are discrete: one chooses the largest \(k\) whose coverage still reaches the target and reports the coverage actually achieved.
Procedure, small samples.
- (i).
- Arrange the data in ascending order.
- (ii).
- Using binomial tables with \(p = \tfrac 12\), find the largest \(k\) with \(P\!\left (\text {Bin}(n,\tfrac 12) \leq k-1\right ) \leq \tfrac {\alpha }{2}\).
- (iii).
- Read off \(M_L = X_{(k)}\) and \(M_U = X_{(n+1-k)}\).
- (iv).
- Report the interval together with its actual coverage \(1 - 2P\!\left (\text {Bin}(n,\tfrac 12) \leq k-1\right )\).
Procedure, large samples \((n > 25)\). The binomial is approximated by the normal, and the index is \[k \ \approx \ \dfrac {n}{2} - Z_{\alpha /2}\sqrt {\dfrac {n}{4}},\] rounded down; the limits are then \(X_{(k)}\) and \(X_{(n+1-k)}\) as before.
Example 2.16. A study of side effects of a drug reported \[4.0,\ 3.0,\ 7.0,\ 5.4,\ 3.8,\ 10.0,\ 7.3,\ 2.6,\ 1.8,\ 7.5 .\] Construct a \(95\%\) confidence interval for the population median.
Order the data \((n = 10\), so the small-sample method applies\()\): \[1.8,\ \mathbf {2.6},\ 3.0,\ 3.8,\ 4.0,\ 5.4,\ 7.0,\ 7.3,\ \mathbf {7.5},\ 10.0 .\]
Find \(k\). With \(p = \tfrac 12\) and \(n = 10\), \[\begin {array}{c|c|c|c} k & P\!\left (\text {Bin} \leq k-1\right ) & \text {interval} & \text {coverage}\\\hline 1 & 0.0010 & (1.8,\ 10.0) & 0.9980\\ 2 & 0.0107 & (2.6,\ 7.5) & 0.9785\\ 3 & 0.0547 & (3.0,\ 7.3) & 0.8906 \end {array}\] The largest \(k\) whose tail does not exceed \(\tfrac {\alpha }{2} = 0.025\) is \(k = 2\).
Interval. \[\boxed {\left (M_L,\ M_U\right ) = \left (X_{(2)},\ X_{(9)}\right ) = (2.6,\ 7.5),\quad \text {actual coverage } 97.85\% .}\]
Conclusion. We are at least \(95\%\) confident — in fact \(97.85\%\) — that the population median lies between \(2.6\) and \(7.5\).
Note 2.17. Notice that \(k = 3\) would give the tidier-looking \((3.0, 7.3)\) but covers only \(89.06\%\); it is not a \(95\%\) interval at all. With \(n = 10\) the choice is between \(97.85\%\) and \(89.06\%\) and there is nothing in between, so the honest report names the level achieved rather than the level requested.
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.