From a Sign Test to a Confidence Interval
A sign test can assess a proposed population median, but the same calculation can do more: it can identify a range of median values that the sample does not reject at a chosen level. The resulting interval uses order statistics rather than a normal approximation. Its coverage is exact under the stated continuous-sampling assumptions, and may exceed the requested confidence level because the binomial count is discrete.
Let \(X_1,\ldots,X_n\) be an independent, identically distributed sample from a continuous population with median \(m\). Continuity ensures that an observation equals \(m\) with probability zero. At the true median, each observation is below \(m\) with probability \(1/2\), so the number below \(m\) has a binomial distribution. This is the key fact behind the interval.
The endpoints are order statistics, not estimates of a standard error. A smaller \(c\) gives a wider interval and higher coverage; a larger \(c\) gives a narrower interval and lower coverage. To obtain confidence of at least \(1-\alpha\), choose the largest permitted \(c\) for which \(C_n(c)\geq 1-\alpha\). If no \(c\) beyond zero meets the target, use \(c=0\), provided its coverage meets the target.
Why the Binomial Formula Gives the Coverage
For a fixed candidate median \(m\), define \(B\) as the number of sample observations strictly below \(m\). At the true median, continuity gives \(P(X_i<m)=1/2\). Independence makes the indicators of the events \(X_i<m\) independent Bernoulli random variables, so
The interval contains \(m\) exactly when \(X_{(c+1)}<m\leq X_{(n-c)}\). The first inequality holds when at least \(c+1\) observations are below \(m\), or \(B\geq c+1\). The second holds when fewer than \(n-c\) observations are below \(m\), or \(B\leq n-c-1\). Thus the interval covers \(m\) precisely when
The complementary outcomes are \(B\leq c\) and \(B\geq n-c\). These tails have equal probabilities because a \(\operatorname{Bin}(n,1/2)\) distribution is symmetric. They are disjoint when \(c<n/2\), which is why their probabilities can be added:
Subtracting this rejection probability from one gives \(C_n(c)\). This also explains why the actual confidence level need not equal the requested level exactly: only certain binomial tail probabilities are available.
Assume independent observations from a continuous population and specify the desired minimum confidence, such as 90% or 95%.
For each candidate \(c\), calculate \(C_n(c)=1-2P\{\operatorname{Bin}(n,1/2)\leq c\}\), considering only \(0\leq c<n/2\).
Use the largest \(c\) whose exact coverage is at least the target. A larger value would make the interval too narrow to retain the required coverage.
Order the observations and report \(\left(X_{(c+1)},X_{(n-c)}\right]\), with the actual coverage stated separately from the requested level.
Worked Order-Statistic Intervals
Worked Example: A 90% Interval From Eight Measurements
A hypothetical laboratory samples \(n=8\) independent measurements from a continuous population with median \(m\). The ordered observed measurements are 4, 7, 9, 12, 15, 18, 21, and 26 units. Construct the narrowest central sign-test interval with coverage at least 90%, and calculate its exact coverage.
Method. Compute the binomial lower tail for candidate values of \(c\). The denominator is \(2^8=256\).
For \(c=0\), the two rejection tails contain only \(B=0\) and \(B=8\). Therefore
For \(c=1\), the lower-tail probability is
Thus
For \(c=2\), the cumulative lower tail is \((1+8+28)/256=37/256\), giving \(C_8(2)=1-74/256=182/256=0.7109\). The largest \(c\) meeting the 90% target is therefore \(c=1\). Its endpoints have ranks \(c+1=2\) and \(n-c=7\), so the interval is
The interval has exact coverage \(238/256=0.9297\), or 92.97%, rather than exactly 90%. Common mistake avoided: using \(c=2\) because it produces a narrower interval would reduce coverage to 71.09%, below the required level.
Worked Example: A Paired-Difference Median
A hypothetical study records before-and-after measurements for 14 independent subjects. Let each difference be the after measurement minus the before measurement. Assume the differences are independent observations from a continuous distribution with median \(m_D\), and that none is zero. Their ordered values are \(-12,-9,-7,-5,-3,-1,2,4,6,8,10,13,16,20\). Find the central interval with coverage at least 90%.
Method. Apply the sign-test interval to the differences themselves. The paired design defines each observation as one subject's difference; the target here is the population median difference, not the median of either measurement separately.
For \(n=14\), \(2^{14}=16384\). At \(c=3\), the cumulative lower-tail numerator is
The two tails together have probability \(2(470)/16384=940/16384\), so the coverage is
For the next candidate, \(c=4\), add \({14\choose4}=1001\) to the lower-tail numerator. The coverage becomes
Therefore \(c=3\) is the largest value that achieves at least 90% coverage. The endpoint ranks are \(c+1=4\) and \(n-c=11\). Hence the interval for the population median difference is
The exact coverage is \(15444/16384=0.9426\), to four decimals. Common mistake avoided: the upper rank is \(n-c=11\), not \(n-c+1=12\); using rank 12 would not invert the stated sign-test acceptance rule.
Worked Example: Selecting Endpoints for a 95% Target
A hypothetical actuary studies 12 independent, continuous claim-processing times, measured in days. Treat the observations as draws from a population with median \(m\). In increasing order, the values are 3.1, 4.0, 4.8, 5.2, 5.9, 6.3, 7.1, 7.8, 8.4, 9.6, 11.2, and 13.0. Find the narrowest central interval with coverage at least 95%.
Method. Compare successive values of \(c\) using the \(\operatorname{Bin}(12,1/2)\) tails. The denominator is \(2^{12}=4096\).
At \(c=2\), the cumulative tail numerator is \(1+12+66=79\). Thus
At \(c=3\), add \({12\choose3}=220\), giving a cumulative numerator of \(299\). Then
Since \(c=2\) meets the 95% target and \(c=3\) does not, \(c=2\) is the largest acceptable value. The interval endpoints are the third and tenth order statistics:
Its exact coverage is \(3938/4096=0.9614\), to four decimals. The procedure gives 96.14% coverage, which is at least the requested 95%. Common mistake avoided: reporting 95% as the interval's exact coverage would confuse the target with the coverage actually attained by the discrete binomial rule.
Conditions and Exam Traps
The exact formula is not a universal interval for every distribution or every data set. Its binomial derivation requires independent observations from a continuous population and a median \(m\) for which each observation has probability \(1/2\) of lying below it. For paired data, apply the method to the differences: the differences from distinct pairs must be independent and drawn from a continuous distribution with the target median. A symmetry assumption is not needed for this sign-based interval.
Continuity matters. If the population is discrete, observations can equal the median with positive probability, and the below-median sign probability need not be \(1/2\). Likewise, ties created by rounding or repeated observed values may make the continuous-model calculation questionable. Do not silently treat a data set with relevant ties as if the continuous, no-tie assumptions had automatically been satisfied; the appropriate treatment depends on the data model and how values were recorded.
There is also an important restriction on doubling the tails. The identity \(P(B\leq c\text{ or }B\geq n-c)=2P(B\leq c)\) requires disjoint tails, which holds for \(0\leq c<n/2\). For example, if \(n=2\) and \(c=1\), the events \(B\leq1\) and \(B\geq1\) overlap at \(B=1\). Doubling the lower tail would give \(2(1+2)/4=1.5\), an impossible probability. The rejection event is actually certain in that case, with probability 1; the correct remedy is to enforce the disjoint-tail restriction before using the doubled-tail formula.
Check Your Understanding
For each problem, state the selected value of \(c\), the interval ranks, and the exact coverage when requested. Assume independent observations from a continuous population unless the question concerns paired differences.
- A sample has \(n=7\) observations and the desired coverage is at least 90%. What is the narrowest central sign-test interval rule, and what is its exact coverage? (Answer: \(c=0\); \((X_{(1)},X_{(7)}]\); \(126/128=0.9844\).)
- For \(n=10\), construct the narrowest central interval with coverage at least 95%. (Answer: \(c=1\); \((X_{(2)},X_{(9)}]\); coverage \(1002/1024=0.9785\).)
- For \(n=16\), find the narrowest central interval with coverage at least 90%. (Answer: \(c=4\); \((X_{(5)},X_{(12)}]\); coverage \(60502/65536=0.9232\).)
- A paired study has 11 independent, continuous, nonzero differences. Find the central interval rule with coverage at least 90%, including its exact coverage. (Answer: \(c=2\); \((D_{(3)},D_{(9)}]\); coverage \(1914/2048=0.9346\).)
- For \(n=8\), a proposed interval is \((X_{(2)},X_{(7)}]\). Determine its \(c\) and exact coverage, and explain why doubling the tails is valid. (Answer: \(c=1\); coverage \(238/256=0.9297\); the rejection tails \(B\leq1\) and \(B\geq7\) are disjoint.)