Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

The Wilcoxon signed-rank test compares two paired conditions or one sample against a hypothesized median when a tt test is not appropriate. It is useful when differences are ordinal, nonnormal, or affected by outliers, as long as the distribution of differences is roughly symmetric. This cheat sheet helps students follow the full workflow from hypotheses to ranks, test statistic, and conclusion.

It is especially helpful for checking hand calculations and interpreting software output.

The test begins by forming paired differences did_i, removing zero differences, ranking di|d_i|, and attaching the sign of each original difference. The positive rank sum is W+W^+, the negative rank sum is WW^-, and a common two-sided statistic is W=min(W+,W)W=\min(W^+,W^-). For larger samples, W+W^+ can be converted to a normal score using μW=n(n+1)4\mu_W=\frac{n(n+1)}{4} and σW=n(n+1)(2n+1)24\sigma_W=\sqrt{\frac{n(n+1)(2n+1)}{24}}.

The decision is based on the pp-value, the significance level α\alpha, and the direction of the alternative hypothesis.

Key Facts

  • Use the Wilcoxon signed-rank test for paired data when the median difference is being tested and the paired differences are roughly symmetric.
  • For each pair, compute the difference as di=xiyid_i=x_i-y_i or di=afteribeforeid_i=\text{after}_i-\text{before}_i, but keep the same direction throughout the test.
  • Remove all observations with di=0d_i=0 before ranking, and let nn be the number of remaining nonzero differences.
  • Rank the absolute differences di|d_i| from smallest to largest, using average ranks for ties.
  • Compute the positive rank sum W+=RiW^+=\sum R_i for all di>0d_i>0 and the negative rank sum W=RiW^-=\sum R_i for all di<0d_i<0.
  • For a two-sided small-sample test, the test statistic is often W=min(W+,W)W=\min(W^+,W^-), with unusually small WW giving evidence against H0H_0.
  • For a large-sample approximation, use z=W+μWσWz=\frac{W^+-\mu_W}{\sigma_W}, where μW=n(n+1)4\mu_W=\frac{n(n+1)}{4} and σW=n(n+1)(2n+1)24\sigma_W=\sqrt{\frac{n(n+1)(2n+1)}{24}} when there are no ties.
  • A common effect size is r=znr=\frac{|z|}{\sqrt{n}}, where larger values of rr indicate stronger practical evidence.

Vocabulary

Paired difference
A paired difference is the value di=xiyid_i=x_i-y_i computed from two related measurements on the same subject or matched pair.
Signed rank
A signed rank is the rank of di|d_i| with the positive or negative sign of the original difference did_i attached.
Positive rank sum
The positive rank sum W+W^+ is the total of the ranks whose original differences satisfy di>0d_i>0.
Negative rank sum
The negative rank sum WW^- is the total of the ranks whose original differences satisfy di<0d_i<0.
Null hypothesis
For the signed-rank test, the null hypothesis usually states that the population median difference is 00.
Normal approximation
The normal approximation uses z=W+μWσWz=\frac{W^+-\mu_W}{\sigma_W} to estimate a pp-value when the sample size is large enough.

Common Mistakes to Avoid

  • Keeping zero differences in the ranking is wrong because values with di=0d_i=0 give no direction and must be removed before computing nn.
  • Ranking the signed differences instead of di|d_i| is wrong because the Wilcoxon method ranks magnitudes first and adds signs afterward.
  • Changing the subtraction order halfway through is wrong because reversing di=xiyid_i=x_i-y_i changes which ranks count as positive and negative.
  • Using the signed-rank test for independent groups is wrong because the method assumes paired or matched observations, not two unrelated samples.
  • Ignoring ties in di|d_i| is wrong because tied absolute differences must receive average ranks, which can change W+W^+, WW^-, and the pp-value.

Practice Questions

  1. 1 For paired differences d=(3,1,4,2,0,5)d=(-3,1,4,-2,0,5), remove zeros, rank the absolute differences, and compute W+W^+, WW^-, and WW.
  2. 2 A study has nonzero paired differences with signed ranks 1-1, +2+2, +3+3, 4-4, +5+5, and +6+6. Find W+W^+, WW^-, and the two-sided statistic WW.
  3. 3 For a large-sample signed-rank test with n=20n=20 and W+=155W^+=155, compute μW\mu_W, σW\sigma_W, and the approximate zz score using z=W+μWσWz=\frac{W^+-\mu_W}{\sigma_W}.
  4. 4 Explain why the Wilcoxon signed-rank test may be preferred over a paired tt test when paired differences contain outliers but remain roughly symmetric.