How to do a Friedman test (nonparametric repeated measures)
The Friedman test compares three or more paired conditions (the same animal, donor or experimental run measured under each condition) using ranks within each row. It is the nonparametric alternative to repeated-measures ANOVA. This guide walks through within-row ranking, the χ² statistic and P value, Kendall’s W as the effect size, and post hoc comparisons, with numbers you can check.
When to use it
- Paired data: the same subject (donor, run) measured under three or more conditions
- Rank within each row (1 to k) and compare the rank sums of the conditions
- Differences close to normal → repeated-measures ANOVA; skewed or outliers → Friedman
- Two conditions → Wilcoxon signed-rank test; unpaired groups → Kruskal–Wallis test
Each subject’s overall level (donor A is always high, say) disappears once you rank within the row. Think of it as testing whether the ordering of the conditions is consistent across rows.
Example: 8 donors × 3 conditions
Cells from 8 donors were treated with vehicle, 1 µM or 10 µM and the response was measured (made up). Rank the values 1, 2, 3 within each row.
| Donor | Vehicle (rank) | 1 µM (rank) | 10 µM (rank) |
|---|---|---|---|
| 1 | 5.1 (1) | 6.0 (2) | 7.2 (3) |
| 2 | 4.8 (1) | 5.9 (2) | 6.1 (3) |
| 3 | 6.2 (2) | 6.1 (1) | 8.0 (3) |
| 4 | 5.5 (1) | 6.8 (2) | 7.1 (3) |
| 5 | 4.9 (1) | 5.2 (2) | 6.6 (3) |
| 6 | 5.7 (1) | 7.1 (3) | 6.9 (2) |
| 7 | 5.0 (1) | 6.3 (2) | 7.4 (3) |
| 8 | 6.0 (1) | 6.6 (2) | 7.7 (3) |
| Rank sum | 9 | 16 | 23 |
Computing χ²
Here χ² = 12 / (8 × 3 × 4) × (9² + 16² + 23²) − 3 × 8 × 4 = 108.25 − 96 = 12.25; with 2 degrees of freedom, P = 0.0022. With no difference, every rank sum would be close to n(k + 1)/2 = 16.
Effect size: Kendall’s W
Here W = 12.25 / (8 × 2) = 0.77. Kendall’s W is a coefficient of concordance, originally for how well several raters agree in their rankings; here it says how consistently the donors order the conditions. Six of the eight donors show Vehicle < 1 µM < 10 µM.
Which conditions differ: Dunn-type comparisons
If the Friedman test is significant, compare the rank sums for each pair. In the Dunn-type method (as in Prism), z = (Ri − Rj) / √(nk(k + 1)/6) gives a two-sided P that is then adjusted for the number of comparisons (here the denominator is √(8 × 3 × 4 / 6) = 4).
| Comparison | Rank sum diff. | z | Unadjusted P | Bonferroni | Holm |
|---|---|---|---|---|---|
| Vehicle vs 1 µM | 7 | 1.75 | 0.080 | 0.240 | 0.160 |
| Vehicle vs 10 µM | 14 | 3.50 | 0.00047 | 0.0014 | 0.0014 |
| 1 µM vs 10 µM | 7 | 1.75 | 0.080 | 0.240 | 0.160 |
Vehicle vs 10 µM is clear, but neighboring conditions are not significant with 8 donors. Comparing only with the control (vehicle) reduces the number of comparisons to 2. Bonferroni vs Holm is explained in Kruskal–Wallis and Dunn’s test.
Friedman vs repeated-measures ANOVA
Repeated-measures ANOVA on the same data gives F(2, 14) = 37.9, P = 2.2 × 10−6, far smaller than Friedman’s P = 0.0022, because Friedman keeps only the within-row ranks and discards the size of the differences. The other side of this is that an extreme value in one row only moves one rank, so Friedman is robust to outliers.
If the differences are close to normal and there are no outliers, RM ANOVA finds differences more easily; then mind the sphericity assumption (repeated-measures ANOVA and sphericity).
How to write it in a paper
Methods: “The three conditions were compared using the Friedman test (values from the same donor matched) followed by Dunn’s multiple comparisons test with Bonferroni correction.” Results: “The response differed between conditions (Friedman χ²(2) = 12.25, P = 0.002, Kendall’s W = 0.77, n = 8); 10 µM was higher than vehicle (P = 0.001).” If rows were dropped because of missing values, say how many.
FAQ
How is it different from the Kruskal–Wallis test?
Kruskal–Wallis ranks all values together and is for independent groups. Friedman ranks values only within each row (subject), so differences in overall level between subjects drop out. Using Kruskal–Wallis on repeated measurements throws away the pairing.
What happens to rows with a missing value?
Because ranks are assigned within each row, a row missing any condition cannot be used and is dropped (BenchFig does this and reports how many rows were dropped). With many missing values, consider a mixed-effects model.
Can I use it with only two conditions?
With two conditions the Friedman test is equivalent to (the normal approximation of) the sign test, which only counts increases and decreases. The Wilcoxon signed-rank test also uses the size of the differences and is usually more powerful, so use it for two conditions. BenchFig uses Wilcoxon for 2 groups and Friedman for 3 or more.
Why is P so much larger than with repeated-measures ANOVA?
Friedman uses only the within-row ranks (1, 2, 3), discarding the size of the differences, and with small n the possible P values are coarse. If the differences are close to normal, RM ANOVA is more powerful; with outliers, Friedman is safer.
Related guides
Product and journal names are trademarks or registered trademarks of their respective owners.