Tutorials › VEE Mathematical Statistics › Exact One-Sided Signed-Rank Tests

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

Exact One-Sided Signed-Rank Tests

Use the exact signed-rank distribution to test a directional location hypothesis, calculate a p-value, and select a discrete critical value.

Intermediate 12 min read

What You'll Learn

  • State the symmetry and independence assumptions behind the exact signed-rank null law
  • Rank nonzero absolute differences and calculate the positive signed-rank sum
  • Find exact upper- and lower-tail p-values from subset-sum probabilities
  • Use the signed-rank distribution to choose a nonrandomized critical value
  • Recognize why one-sided tails include the observed statistic

Why Use an Exact One-Sided Signed-Rank Test?

Paired measurements often produce differences that have a meaningful direction: a positive difference might indicate an increase after a treatment, while a negative difference indicates a decrease. The signed-rank test uses both the signs and the ranks of the absolute differences. For a one-sided question, the evidence is directional, so the p-value comes from one tail of the signed-rank null distribution.

For small samples, that distribution can be calculated exactly rather than approximated by a normal distribution. Exact calculation matters because signed-rank statistics are discrete: only certain rank sums can occur, and their probabilities need not match the nominal significance level exactly. This tutorial covers samples with no zero differences and no tied absolute differences.

Definition: Let \(D_1,\ldots,D_n\) be independent paired or one-sample differences. Assume their distribution is continuous and symmetric about zero under the null hypothesis. Rank the absolute differences \(|D_i|\) from 1 to \(n\), with rank 1 assigned to the smallest absolute difference. The positive signed-rank statistic, \(W^+\), is the sum of the ranks whose differences are positive. The negative signed-rank sum is \(W^- = n(n+1)/2-W^+\).

The exact null calculation requires the signs to be equally likely to be positive or negative, conditional on the observed absolute differences. Symmetry about zero gives this equal-sign property; independence gives independent signs. Continuity and the no-ties condition ensure the ranks are exactly \(1,\ldots,n\), with no zero differences to handle separately.

A common directional formulation tests a zero-centered symmetric null against a positive shift or a negative shift. The signed-rank test is often used in a location-shift model, in which the distribution retains its shape and moves by a location parameter. A conclusion about a general change in distribution requires care: the test is not simply a test of an arbitrary difference in means, and its interpretation relies on the symmetry and location assumptions.

How the Exact Null Distribution Is Built

Once the absolute differences have been ranked, the ranks are fixed. Under the null, each of the \(n\) ranks independently has probability \(1/2\) of receiving a positive sign and probability \(1/2\) of receiving a negative sign. Thus every possible assignment of signs has probability \(1/2^n\), and \(W^+\) is the sum of the ranks assigned positive signs.

$$ P_0(W^+=w) = \frac{\text{number of subsets of }\{1,2,\ldots,n\}\text{ that sum to }w}{2^n}. $$

The subset description explains why an exact calculation is possible. For example, with ranks \(1,2,3,4,5\), a positive rank sum of 8 can arise from the subsets \(\{1,2,5\}\), \(\{1,3,4\}\), and \(\{3,5\}\). There are 32 sign assignments in total, so \(P_0(W^+=8)=3/32\).

Theorem: For an observed value \(w_{\mathrm{obs}}\), the exact upper-tailed p-value is \(P_0(W^+\geq w_{\mathrm{obs}})\), and the exact lower-tailed p-value is \(P_0(W^+\leq w_{\mathrm{obs}})\). The observed value is included in its tail. These are conditional null probabilities given the absolute ranks.

The upper tail is appropriate when large positive signed-rank sums support the alternative; the lower tail is appropriate when small sums support it. Including the observed statistic is essential: the p-value is the null probability of the observed result or a result at least as extreme in the specified direction. Because the distribution is discrete, the p-value usually cannot be chosen to equal a requested significance level exactly.

Worked Examples

Worked Example: Upper-Tailed Test With Five Paired Differences

A hypothetical study records the change in a measurement for five independent participants, defined as after minus before. Test the directional alternative that the changes tend to be positive. The observed differences are \(-1, 2, 3, 4, 6\). Use an exact test and report the p-value to four decimal places.

Method and assumptions. Use the exact upper-tailed signed-rank test. Assume the differences are independent and the null distribution is continuous and symmetric about zero. The absolute differences \(1,2,3,4,6\) are distinct, and no difference is zero, so their ranks are \(1,2,3,4,5\).

Calculate the observed statistic. The positive differences are \(2,3,4,6\), with ranks \(2,3,4,5\). Therefore,

$$ W^+_{\mathrm{obs}}=2+3+4+5=14. $$

Find the upper-tail probability. With five ranks there are \(2^5=32\) equally likely sign assignments. A sum of at least 14 is possible only as 14 or 15. The subset for 14 is \(\{2,3,4,5\}\), and the subset for 15 is \(\{1,2,3,4,5\}\). Each occurs once, so

$$ p=P_0(W^+\geq 14)=\frac{2}{32}=0.0625. $$

At significance level \(0.05\), do not reject the null; at level \(0.10\), reject it. The p-value is the same either way, while the decision depends on the selected level. The method avoids the common mistake of counting only outcomes strictly greater than 14, which would omit the observed-rank-sum outcome and incorrectly give \(1/32\).

Worked Example: A Lower-Tailed Test and Its Critical Value

A hypothetical process is assessed using five independent changes, with negative values representing a decrease. The observed differences are \(2,-1,-3,-4,-5\). Test for a negative shift at significance level \(0.10\), and identify the exact lower-tail critical value.

Method and assumptions. Use the exact lower-tailed signed-rank test, assuming independent differences and a continuous null distribution symmetric about zero. The absolute differences are distinct and nonzero. Their ranks in order of absolute size are 1 for \(-1\), 2 for \(2\), 3 for \(-3\), 4 for \(-4\), and 5 for \(-5\).

Calculate the observed statistic. Only the difference \(2\) is positive, and its rank is 2. Thus \(W^+_{\mathrm{obs}}=2\).

Calculate the exact p-value. The subsets of ranks with sums no greater than 2 are the empty subset, \(\{1\}\), and \(\{2\}\). There are three such sign assignments out of 32:

$$ p=P_0(W^+\leq 2)=\frac{3}{32}=0.09375\approx 0.0938. $$

Check the critical value. At level \(0.10\), a lower-tail rejection rule uses the largest cutoff \(c\) for which \(P_0(W^+\leq c)\leq 0.10\). Here \(P_0(W^+\leq 2)=3/32=0.09375\), but \(P_0(W^+\leq 3)=5/32=0.15625\). Therefore \(c=2\), and the observed statistic is in the rejection region. The exact p-value and the critical-value decision agree.

This method avoids reversing the direction of the test. Evidence for negative changes is a small \(W^+\), not a small \(W^-\); the statistic used here is explicitly the sum of positive ranks.

Worked Example: Exact Upper-Tail Critical Value With Six Ranks

A hypothetical paired assessment produces six independent, nonzero differences: \(-1,2,-3,4,5,6\). Test for a positive shift at level \(0.10\). Calculate the observed statistic and determine the exact upper-tail critical value.

Method and assumptions. Use the exact upper-tailed signed-rank test under a continuous, symmetric zero-centered null with independent differences. The absolute differences are \(1,2,3,4,5,6\), so the ranks in the order listed are \(1,2,3,4,5,6\).

Calculate the observed statistic. The positive differences have ranks \(2,4,5,6\), giving

$$ W^+_{\mathrm{obs}}=2+4+5+6=17. $$

Obtain the relevant null counts. There are \(2^6=64\) sign assignments. Counting rank subsets by their sums gives the following frequencies in the upper tail:

$$ \begin{array}{c|ccccc} w & 17 & 18 & 19 & 20 & 21\\ \hline \text{number of subsets} & 2 & 2 & 1 & 1 & 1 \end{array} $$

Thus \(P_0(W^+\geq17)=(2+2+1+1+1)/64=7/64=0.109375\), or \(0.1094\) to four decimal places. Since this exceeds \(0.10\), the observed statistic does not reject at that level.

For the critical value, the tail probability at 18 is \((2+1+1+1)/64=5/64=0.078125\), while the tail probability at 17 is \(7/64=0.109375\). Therefore the upper-tail critical value is 18: reject when \(W^+\geq18\). This avoids the trap of rounding the p-value down to \(0.10\) and treating it as significant.

Derivation and a Practical Calculation Strategy

The exact distribution follows directly from the sign mechanism. Conditional on the absolute differences, the rank assigned to each observation is known. Under a symmetric null, changing the sign of any one difference leaves its conditional probability unchanged. With independent differences, every sign pattern has probability \(1/2^n\). Each pattern selects a subset of ranks for the positive sum, so counting subsets with the required total gives the exact probability.

A compact way to represent all subset counts is the generating polynomial \(\prod_{r=1}^{n}(1+x^r)\). Choosing 1 from a factor means rank \(r\) is not in the positive subset; choosing \(x^r\) means it is. The coefficient of \(x^w\) therefore counts the subsets with sum \(w\). Dividing that coefficient by \(2^n\) gives \(P_0(W^+=w)\). For hand calculations, listing relevant subsets or using a small frequency table is often clearer.

1
Check the setting.
Identify the paired or one-sample differences, the direction of the alternative, and whether independence, symmetry under the null, no zeros, and distinct absolute differences are reasonable.
2
Rank absolute differences.
Order the nonzero absolute differences from smallest to largest and assign ranks \(1,\ldots,n\).
3
Calculate \(W^+\).
Add the ranks attached to positive differences. Do not add the raw difference values.
4
Choose the correct tail.
For a positive-direction alternative, calculate \(P_0(W^+\geq W^+_{\mathrm{obs}})\). For a negative-direction alternative, calculate \(P_0(W^+\leq W^+_{\mathrm{obs}})\).
5
Report and interpret.
Give the exact probability, its decimal form as needed, and a conclusion in context at the stated significance level.

Critical Values, Scope, and Common Traps

For a nonrandomized upper-tail test at level \(\alpha\), choose a cutoff \(c\) so that the rejection region \(W^+\geq c\) has null probability no greater than \(\alpha\), and is as inclusive as possible without exceeding that level. Equivalently, \(c\) is the smallest attainable cutoff with \(P_0(W^+\geq c)\leq\alpha\). For a lower-tail test, reject for \(W^+\leq c\), choosing the largest cutoff with \(P_0(W^+\leq c)\leq\alpha\). Since the distribution is discrete, the actual test size can be less than \(\alpha\).

The exact calculations in this tutorial depend on the no-ties, no-zeros setting. If there are zero differences or tied absolute differences, the rank construction and null distribution require additional conventions; applying the \(1,\ldots,n\) subset distribution without addressing them is not justified. Likewise, if the differences are not independent or the null symmetry assumption is unsuitable, the exact sign-assignment argument does not apply as stated.

Key takeaway: Under the stated symmetric, independent null, the positive ranks form an equally likely random subset of \(1,\ldots,n\). An upper-tail test uses \(P_0(W^+\geq w_{\mathrm{obs}})\); a lower-tail test uses \(P_0(W^+\leq w_{\mathrm{obs}})\). Include the observed value, and make the tail agree with the alternative.

Check Your Understanding

For each problem, assume independent differences from a continuous distribution symmetric about zero under the null, with no zero differences and no tied absolute differences.

  1. Four observed differences are \(-1,2,3,-4\). For a positive-direction alternative, calculate \(W^+_{\mathrm{obs}}\) and the exact upper-tail p-value. (Answer: \(W^+=5,\ p=9/16=0.5625\).)
  2. Five observed differences are \(1,-2,-3,-4,-5\). For a negative-direction alternative, calculate the exact lower-tail p-value. (Answer: \(W^+=1,\ p=2/32=0.0625\).)
  3. Six observed differences are \(1,-2,3,4,-5,6\). For a positive-direction alternative, calculate \(W^+_{\mathrm{obs}}\) and its exact p-value. (Answer: \(W^+=14,\ p=18/64=0.2813\).)
  4. For \(n=5\), find the nonrandomized upper-tail critical value at level \(0.05\). (Answer: \(c=15\), so reject when \(W^+\geq15\); the rejection probability is \(1/32=0.03125\).)
  5. For \(n=4\), find the nonrandomized lower-tail critical value at level \(0.10\). (Answer: \(c=0\), so reject when \(W^+\leq0\); the rejection probability is \(1/16=0.0625\).)
Clinical Biostats