Course contentsShow
← Data Science
Lesson 392 of 2,14510. Hypothesis Tests for MeansFree lesson

Wilcoxon Signed-Rank Test

Compare paired samples or test a single median by ranking the magnitudes of differences, not just signs.

Wilcoxon Signed-Rank Test

What You'll Learn

You'll learn how to test paired samples or a single median using a non-parametric test that considers both the direction and magnitude of differences.

Why We Need This Test

The Sign Test you just learned only counted whether differences were positive or negative—it ignored how much they differed. The Wilcoxon Signed-Rank Test improves on this by incorporating the size of differences while remaining non-parametric (no normality assumption required).

Think of it like restaurant reviews: the Sign Test only counts thumbs-up vs thumbs-down, but the Wilcoxon test considers whether someone gave 1 star or 5 stars—the intensity of their opinion matters.

How It Works

  1. Calculate paired differences (just like the paired t-test or Sign Test)
  2. Remove zeros (ties where difference = 0)
  3. Rank the absolute values of differences from smallest to largest
  4. Restore the signs to each rank (positive or negative)
  5. Sum the positive ranks (W⁺) and negative ranks (W⁻)
  6. Compare the smaller sum to critical values or compute a p-value

If differences are randomly distributed around zero (H₀), you'd expect roughly equal positive and negative rank sums. A large imbalance suggests a real effect.

When to Use It

  • You have paired samples or want to test a single median
  • Data violates normality assumptions (can't use paired t-test)
  • You want more power than the Sign Test by using magnitude information
  • Differences are at least ordinal (you can rank them meaningfully)

Example Scenario

Testing whether a sleep aid increases sleep duration: instead of just counting who slept longer, you rank how much longer (30 min vs 2 hours matters).

Key Takeaway: The Wilcoxon Signed-Rank Test ranks the magnitudes of paired differences, making it more powerful than the Sign Test while remaining robust to non-normal data.