Data and statistics · cheat sheet

Friedman test

A test of whether several treatments differ when each block (a week, a person, a machine) gets all of them, comparing ranks within each block.

Common practice
4 steps
Used by Process Improvement Specialist

What it is

The Friedman test compares several conditions measured in the same blocks, by ranking within each block and comparing the rank totals.

When to use it

When the same blocks are measured under every condition, and the data isn't normal.

Why it works

It removes block-to-block differences and doesn't need normal data.

Do

  • Use it whenever the same blocks appear in every column.

Don't

  • Treating the values as independent and using Kruskal-Wallis instead.

Step by step

  1. One row per block
  2. Rank within rows
  3. Rank sums per condition
  4. Statistic and p-value
Also called: Rank test for blocksPrint the blank template ↗

Worked example

The situation. Errors per shift over 6 weeks: early, late and night shifts.

  1. Rank sums: early 9.5, late 18, night 8.5.

The result. The late shift has the most errors week after week; handover times were changed.

Friedman worksheet Print blank
PartValue
Statistic9.48
Degrees of freedom2
p-value0.009

Filled in for: Errors per shift over 6 weeks: early, late and night shifts.

BlockCon­dition 1Con­dition 2Con­dition 3Con­dition 4

Copy this structure, or print the blank version and fill it in by hand. Rank within each row, then add the ranks per column

Before you use it: check these

CheckIf it fails
Every block has a value for every conditionFill the gaps or use a method that handles missing values
Blocks are independent of each otherCheck for trends across blocks

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 Monday worse every week, or just on average?

From Day 33: Every week, or just some? of the Process Improvement Specialist story

A busy week could make one Monday look bad. Astrid (Data Analyst) takes the median wait for each weekday in each of the nine weeks, and compares days within each week.

Step by step

  1. Why this testthe same weeks appear in every column (blocks), and data isn't normal= Friedman test
  2. Rank within each week1 = shortest wait that week, 5 = longest; ties share
  3. Add the ranks by dayMonday 45 · Tuesday 29.5 · Wednesday 23 · Thursday 17.5 · Friday 20
  4. Test statisticcompares the rank sums with what chance would give= 22.85
  5. p-valuechi-square with 4 degrees of freedom= 0.0001
WeekMondayTuesdayWednesdayThursdayFriday
Week 12138866
Week 131412979
Week 14147895
Week 15117686
Week 16149578
Week 17117769
Week 181410888
Week 191291169
Week 2014131179

How to read the result

Monday has the longest wait in almost every week, not just on average. The Monday effect is consistent, not caused by a few bad weeks.

What it led to

Monday capacity becomes a key target for the Improve phase.

Do it in a spreadsheet

Rank within a week=RANK.AVG(B2,$B2:$F2,1)
Rank sum for Monday=SUM(G2:G10)
Test statistic=12/(9*5*6)*SUMSQ(rank sums)-3*9*6 (no tie adjustment)
p-value=CHISQ.DIST.RT(statistic,4)
Try it yourself: Why not use Kruskal-Wallis on these 45 numbers?

Because each row is the same week: the values aren't independent. Friedman compares days within each week, removing the week-to-week differences.

In the roles

How a Process Improvement Specialist uses it

Median waits by weekday in each of nine weeks: Monday's rank sum is 45, the maximum; p = 0.0001.

Questions people ask

Is there a normal-data version?

Yes: two-way ANOVA without interaction.

Related techniques

← All techniques and tools