Data and statistics · cheat sheet

One-sample Wilcoxon test

A test of whether the median differs from a target that uses both the direction and the size of each value's distance from it, through ranks.

Common practice
4 steps
Used by Process Improvement Specialist

What it is

The one-sample Wilcoxon signed-rank test compares the median with a target using both the sign and the rank of each distance from it.

When to use it

With continuous data that isn't normal but is roughly symmetrical around its median.

Why it works

More powerful than the sign test, without assuming normal data.

Do

  • Check the data is roughly symmetrical around the median.

Don't

  • Using it on very asymmetrical data, where the sign test is safer.

Step by step

  1. Differences from target Drop zeros.
  2. Rank absolute differences
  3. Sum positive ranks
  4. p-value
Also called: Wilcoxon signed-rank testPrint the blank template ↗

Worked example

The situation. The same 15 delivery times against 3 days.

  1. Ranks of the distances, added for the deliveries above 3 days.

The result. Confirms the sign test, with more certainty.

Wilcoxon worksheet Print blank
PartValue
Sum of positive ranks99
p-value (one-sided)0.002

Filled in for: The same 15 delivery times against 3 days.

ItemValueValue − targetAbsolute dif­ferenceRankSign

Copy this structure, or print the blank version and fill it in by hand.

Before you use it: check these

CheckIf it fails
Distances from the target are meaningfulUse the sign test if only direction can be trusted
Roughly symmetrical around the medianUse the sign test for very lopsided data

How to do it with real data

The full calculation, as it happens in the story: the data, every step, how to read the result, and the spreadsheet functions to do it yourself.

Worked example with real data

Is the median wait above 7? Two tests compared

From Day 29: When the data isn't normal of the Process Improvement Specialist story

The waits are skewed, so Amara also tests the median, with two tests that don't need normal data.

Step by step

  1. HypothesesH0: the median is 7. H1: it is above 7
  2. Sign test: count signsabove 7: 33 · below 7: 24 · equal: 3 (left out)= 57 used
  3. Sign test: p-valuechance of 33 or more “above” out of 57 if each were 50:50= 0.14
  4. Wilcoxon: rank the distancesrank |wait − 7| for the 57, add the ranks of waits above 7= W = 1,277.5
  5. Wilcoxon: p-valuefrom the rank sum= 0.0002
  6. Comparethe sign test only uses direction; Wilcoxon also uses how far= Wilcoxon is more powerful
RequestWait (days)Above or below 7
R0112Above
R0213Above
R0312Above
R0428Above
R0511Above
R0612Above
R0716Above
R087Equal
R093Below
R104Below
R114Below
R1210Above
R134Below
R1417Above
R155Below
R168Above
R175Below
R185Below
R195Below
R2020Above
R213Below
R2215Above
R235Below
R249Above
R255Below
R265Below
R2715Above
R2815Above
R2914Above
R3013Above
R3118Above
R3216Above
R333Below
R345Below
R3510Above
R367Equal
R376Below
R3810Above
R3910Above
R405Below
R415Below
R424Below
R435Below
R446Below
R457Equal
R4611Above
R4711Above
R483Below
R4913Above
R5026Above
R5112Above
R5222Above
R5327Above
R5418Above
R554Below
R5614Above
R5720Above
R583Below
R596Below
R6019Above

How to read the result

The sign test can't prove the median is above 7 with this sample (p = 0.14), because it ignores how far above or below each wait is. The Wilcoxon test uses those distances and shows clearly that it is (p = 0.0002).

What it led to

Use the Wilcoxon test when the data is roughly symmetrical around the median; use the sign test only when you can't trust the distances, for example with ratings. Here the conclusion matches the t-test.

Do it in a spreadsheet

Count above=COUNTIF(B2:B61,">7")
Sign test p-value=1-BINOM.DIST(32,57,0.5,TRUE)
Wilcoxonrank =ABS(B2-7) with RANK.AVG, sum the ranks where B2>7; spreadsheets have no built-in p-value: use the normal approximation or a statistics add-on
Try it yourself: In another sample, 40 of 50 values are above the target and 10 below. Would the sign test show a difference?

Yes. 40 of 50 is far from 25 of 50: p = 1 − BINOM.DIST(39,50,0.5,TRUE), about 0.00001.

In the roles

How a Process Improvement Specialist uses it

Waits against 7 days: W = 1,277.5, p = 0.0002. The median is above 7.

Questions people ask

Is there a paired version?

Yes: run it on before-minus-after differences.

Related techniques

← All techniques and tools