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.

Understanding Wilcoxon Signed-Rank Test Walkthrough

The key idea is that pairing removes person-to-person variation. Suppose a teacher measures each student’s score before and after a study routine. Some students usually score higher than others for reasons unrelated to the routine.

Looking at the change within each student is fairer than comparing two unrelated class averages. The same logic appears in medical studies, product tests, repeated sensor measurements, and surveys taken before and after an event.

Each pair must truly belong together. A score from one student cannot be paired with a score from a different student just because the two scores seem similar.

Ranks give more weight to larger changes without trusting the exact numerical gaps too much. A change of one point is weaker evidence than a change of ten points, so it receives a lower rank. Yet the method does not treat a ten point change as exactly ten times as important.

This makes the test less sensitive to a few extreme differences than a paired t test. The signs then show whether the larger changes mostly point in one direction.

If positive and negative ranks balance closely, the data fit the idea of no typical shift. If one sign collects most of the rank total, the evidence points toward a shift in that direction.

The symmetry condition deserves careful attention. It applies to the distribution of the paired differences, not to the original before values or after values separately. Differences can be centered near zero with a roughly even spread above and below zero.

A long tail on only one side can cause trouble because the signed-rank method relies on positive and negative changes being comparable in shape. A histogram or dot plot of the differences can help reveal this.

With very small samples, plots are limited, so students should use knowledge of the setting too. If differences are strongly skewed, the sign test may be a safer choice, though it usually has less power because it ignores change sizes.

Software output can differ slightly across programs for valid reasons. Programs may use an exact distribution for small samples, a normal approximation for larger samples, or corrections for tied ranks and zero differences. A continuity correction can alter the reported normal score and p value a little.

Students should identify whether the reported statistic is the positive rank sum or the smaller of the two rank sums before comparing results to a table. The p value measures how unusual the observed rank imbalance would be if there were no median change. It does not measure the size or importance of the change.

Report a direction, an effect size, and the actual changes in context. A statistically detectable one point increase may still matter very little in a real classroom or clinic.