Tutorials › VEE Mathematical Statistics › Exact One-Sided Sign Tests

VEE Mathematical Statistics · Sign and Wilcoxon Tests · Tutorial 835 of 880

Exact One-Sided Sign Tests

Calculate exact one-sided sign-test p-values and rejection regions while handling ties and interpreting the direction of evidence correctly.

Intermediate 12 min read

What You'll Learn

  • Define the sign probability being tested and state the assumptions that make the exact binomial test valid
  • Calculate upper-tail and lower-tail exact p-values from the observed nonzero signs
  • Find one-sided rejection cutoffs for a chosen significance level
  • Explain why a discrete test may have actual size below its nominal level
  • Apply the procedure to one-sample and paired-difference median questions
  • Recognize how ties, direction, and tail inclusivity affect a test

Why One-Sided Sign Tests Are Useful

A one-sided sign test asks whether observations tend to fall above or below a specified benchmark. It is useful when the target is a population median, or the median of paired differences, and a distributional model for the magnitudes of observations is not justified. The test uses only the direction of each nonzero deviation, not its size.

The exact calculation is a binomial tail probability. The direction of the alternative determines which tail to calculate: evidence that the median is greater than the benchmark comes from an unusually large number of positive signs; evidence that it is smaller comes from an unusually small number.

Definition: Let \(\theta_0\) be a hypothesized median. For independent observations \(X_1,\ldots,X_N\), discard observations equal to \(\theta_0\), and let \(n\) be the number remaining. Let \(B\) be the number of the \(n\) remaining observations greater than \(\theta_0\). The one-sided sign test uses \(B\) to test whether signs occur more often in the direction specified by the alternative.

For a paired question, first define each difference consistently, such as \(D_i=\text{after}_i-\text{before}_i\). Apply the same procedure to the differences using benchmark zero. A positive sign then means an increase under this definition; reversing the order of subtraction reverses the interpretation and the test tail.

Model, Hypotheses, and Exact Tails

The exact sign test assumes independent observations (or independent pairs) and a null model in which each nonzero sign has probability one-half of being positive. A standard sufficient setting is a continuous distribution under the null, so there are no ties at the hypothesized median. For a one-sided composite hypothesis about a median, continuity and the median ordering imply that the probability of a positive sign is at most one-half under a null median no greater than \(\theta_0\), and at least one-half under a null median no less than \(\theta_0\). The boundary probability one-half gives the exact reference distribution.

If the data can have a point mass at \(\theta_0\), simply omitting ties does not always make the remaining signs equally likely under a median null. In that setting, the analyst must justify the conditional sign probability separately; the usual exact binomial test is not automatically valid. When the half-and-half sign model holds, the number of positive signs has the null distribution shown below.

$$ B\sim\operatorname{Binomial}(n,1/2),\qquad P(B=k)=\binom{n}{k}\left(\frac12\right)^n,\quad k=0,1,\ldots,n. $$

For \(H_1:\theta>\theta_0\), large values of \(B\) support the alternative. If \(b\) positive signs are observed, the upper-tail p-value is the probability, under the boundary null, of observing \(b\) or more positive signs. For \(H_1:\theta<\theta_0\), small values support the alternative, so the lower-tail p-value is the probability of observing \(b\) or fewer positive signs.

$$ p_{\text{upper}}=P(B\ge b) =\sum_{k=b}^{n}\binom{n}{k}2^{-n}, \qquad p_{\text{lower}}=P(B\le b) =\sum_{k=0}^{b}\binom{n}{k}2^{-n}. $$

The inclusive endpoints matter: an outcome equal to the observed count is at least as extreme in the direction of the alternative and must be included. Reject the null at significance level \(\alpha\) when the p-value is no greater than \(\alpha\). A p-value is not the probability that the null hypothesis is true.

Why the Binomial Tail Gives the Test

Under the half-and-half sign model, each of the \(n\) nonzero observations independently produces a positive sign with probability \(1/2\). There are \(\binom{n}{k}\) ways for exactly \(k\) of the \(n\) signs to be positive, and each sign pattern has probability \(2^{-n}\). Thus the probability of exactly \(k\) positives is \(\binom{n}{k}2^{-n}\). For an upper alternative, the mutually exclusive outcomes \(B=b,b+1,\ldots,n\) are precisely the outcomes at least as favorable to that alternative as the observed data; adding their probabilities gives the upper-tail p-value. The lower-tail argument sums \(B=0,1,\ldots,b\).

For a composite upper null, the boundary probability \(1/2\) is the least favorable value: if the positive-sign probability is smaller, large positive counts become less likely. One way to see this is to generate each sign using an independent uniform random variable \(U_i\) on \([0,1]\), declaring a sign positive when \(U_i\le q\). Decreasing \(q\) can only change positive signs to nonpositive signs, not the other way around. The corresponding argument applies to the lower-tail test. This is why the boundary binomial tail controls the one-sided test size.

Worked Examples

Worked Example: Testing Whether a Service Time Median Increased

A hypothetical service center compares \(9\) independent service times with a target of \(40\) minutes. One time equals \(40\) and is a tie; among the other \(8\), \(7\) exceed \(40\) and \(1\) is below it. Test \(H_0:\theta\le 40\) against \(H_1:\theta>40\) at \(\alpha=0.05\). Assume service times are independent and continuous at \(40\), so the null sign model for the \(n=8\) non-ties is \(B\sim\operatorname{Binomial}(8,1/2)\). No interest-rate or mortality assumption is involved.

Method. This is an upper-tail exact sign test. The tied observation is omitted, so \(n=8\), and the observed positive count is \(b=7\).

Under the null, \(2^8=256\), and the relevant binomial coefficients are \(\binom{8}{7}=8\) and \(\binom{8}{8}=1\). Therefore

$$ p_{\text{upper}} =P(B\ge 7) =\frac{\binom{8}{7}+\binom{8}{8}}{2^8} =\frac{8+1}{256} =\frac{9}{256} =0.03515625. $$

Rounded to four decimal places, the p-value is \(0.0352\). Since \(0.0352<0.05\), reject the null at the 5% level. The signs provide evidence that the population median service time exceeds \(40\) minutes.

Check. The p-value includes the chance of \(7\) positives and the chance of all \(8\) positives; their probabilities add to \(9/256\). A common mistake is to count all \(9\) observations in the binomial distribution. The tie is not a positive or negative sign, so the correct binomial parameter is \(n=8\), not \(9\).

Worked Example: Testing for a Decrease in Paired Measurements

In a hypothetical paired study, define each difference as \(D_i=\text{after}_i-\text{before}_i\), in measurement units. The \(8\) recorded differences are \(-4,-2,0,-1,-3,+2,-5,-1\). Test whether the median difference is below zero at \(\alpha=0.10\). Assume pairs are independent and the null sign probability among nonzero differences is one-half; there is no interest-rate or mortality model.

Method. This is a lower-tail exact sign test because a negative median difference represents a decrease. The zero difference is omitted. Of the remaining \(n=7\) differences, \(b=1\) is positive and \(6\) are negative.

Under the null, \(B\sim\operatorname{Binomial}(7,1/2)\), so the lower-tail p-value is

$$ p_{\text{lower}} =P(B\le 1) =\frac{\binom{7}{0}+\binom{7}{1}}{2^7} =\frac{1+7}{128} =\frac{8}{128} =0.0625. $$

Because \(0.0625<0.10\), reject the null at the 10% level. The data support a negative median after-minus-before difference. This conclusion concerns the direction of the median, not the average size of the decrease.

Check. There are \(7\) nonzero differences, with one positive sign, and the lower tail includes \(0\) and \(1\) positives. A common mistake is to reverse the alternative because “decrease” sounds positive in ordinary language. With the stated after-minus-before definition, a decrease produces negative differences, so the lower tail is correct.

Worked Example: Finding an Upper-Tail Rejection Region

A hypothetical quality analyst plans a one-sided sign test with \(n=10\) independent non-tied measurements, testing whether the median exceeds a target. Assume the null model is \(B\sim\operatorname{Binomial}(10,1/2)\), with no ties at the target. Find the nonrandomized rejection region for \(\alpha=0.05\), then assess a sample with \(8\) positive signs. No interest-rate or mortality assumption is relevant.

Method. For an upper-tail test, choose the smallest integer cutoff \(c\) for which \(P(B\ge c)\le 0.05\). At \(c=9\),

$$ P(B\ge 9) =\frac{\binom{10}{9}+\binom{10}{10}}{2^{10}} =\frac{10+1}{1024} =\frac{11}{1024} =0.0107421875. $$

At the next less stringent cutoff, \(c=8\),

$$ P(B\ge 8) =\frac{\binom{10}{8}+\binom{10}{9}+\binom{10}{10}}{1024} =\frac{45+10+1}{1024} =\frac{56}{1024} =0.0546875. $$

Thus the rejection region is \(B\ge9\): its null probability is at most \(0.05\), while lowering the cutoff to \(8\) would exceed \(0.05\). The actual size is \(11/1024=0.0107\), rounded to four decimals, rather than \(0.05\). For the observed count \(b=8\), the exact p-value is \(56/1024=0.0547\), so the null is not rejected at the 5% level.

Check. The result is consistent both ways: \(0.0547>0.05\), and \(8\) is outside the rejection region \(B\ge9\). A common mistake is to select the cutoff whose tail probability is closest to \(0.05\), even if that probability exceeds \(0.05\). A nonrandomized exact test must not exceed its specified level.

Rejection Regions and Discreteness

A rejection region gives the sign counts that lead to rejection before the data are observed. For the upper test, select the smallest integer \(c\) satisfying \(P(B\ge c)\le\alpha\), and reject when \(B\ge c\). For the lower test, select the largest integer \(c\) satisfying \(P(B\le c)\le\alpha\), and reject when \(B\le c\). If no tail probability at a cutoff equals \(\alpha\), the actual test size is smaller than the nominal level. This is a consequence of the binomial distribution's discrete outcomes, not an arithmetic error.

1
State the direction and benchmark.
Write the median or paired-difference median being tested, its benchmark, and whether the alternative is greater or less.
2
Count nonzero signs.
For a one-sample test compare each observation with the benchmark. For a paired test define the differences first. Exclude ties and record the resulting \(n\) and positive count \(b\).
3
Use the matching exact tail.
For a greater-than alternative calculate \(P(B\ge b)\); for a less-than alternative calculate \(P(B\le b)\), using \(B\sim\operatorname{Binomial}(n,1/2)\) under the boundary null.
4
Compare and interpret.
Reject when the p-value is at most \(\alpha\). State the conclusion in the context of the median and preserve the direction of the alternative.

The sign test sacrifices information about magnitudes in exchange for a simple distribution-free procedure under its sign assumptions. A result based on many small positive differences and one very large negative difference uses only the number of signs, not their sizes. This is intentional: the procedure tests a direction in the median, not a mean or a total change.

Key takeaway: For an exact one-sided sign test, remove ties, let \(n\) be the remaining sample size, and count positive signs \(b\). Use the inclusive upper tail for a greater-than alternative and the inclusive lower tail for a less-than alternative. Check the sign model and tail direction before calculating.

Check Your Understanding

For each problem, assume independent observations or pairs and the half-and-half null sign model unless the question asks you to identify an assumption. Report probabilities to four decimal places.

  1. A one-sample upper-tail test has \(n=6\) non-tied observations and \(b=5\) positive signs. Find the exact p-value and state whether to reject at \(\alpha=0.05\). (Answer: \(p=7/64=0.1094\); do not reject.)
  2. In a paired lower-tail test, \(5\) nonzero differences include no positive differences. Find the exact p-value and decision at \(\alpha=0.05\). (Answer: \(p=1/32=0.0313\); reject.)
  3. For an upper-tail test with \(n=9\), find the smallest rejection cutoff at \(\alpha=0.10\), and give the actual size. (Answer: reject for \(B\ge7\); size \(46/512=0.0898\).)
  4. A lower-tail test has \(n=8\) and observed positive count \(b=2\). Calculate the exact p-value and decide at \(\alpha=0.10\). (Answer: \(p=(1+8+28)/256=37/256=0.1445\); do not reject.)
  5. A one-sample upper-tail test has \(10\) recorded observations, one exactly equal to the benchmark and \(9\) above it. State the binomial sample size and exact p-value. (Answer: \(n=9\); \(p=P(B\ge9)=1/512=0.0020\).)
Clinical Biostats