CalculatorsToolsGuides 日本語
BenchFig › Guides › How to do a Friedman test (nonparametric repeated measures)
Statistics

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.

Updated: BenchFig日本語

When to use it

Key points
  • 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.

DonorVehicle (rank)1 µM (rank)10 µM (rank)
15.1 (1)6.0 (2)7.2 (3)
24.8 (1)5.9 (2)6.1 (3)
36.2 (2)6.1 (1)8.0 (3)
45.5 (1)6.8 (2)7.1 (3)
54.9 (1)5.2 (2)6.6 (3)
65.7 (1)7.1 (3)6.9 (2)
75.0 (1)6.3 (2)7.4 (3)
86.0 (1)6.6 (2)7.7 (3)
Rank sum91623
4.555.566.577.58Vehicle1 µM10 µMResponse (a.u.)
Cells from 8 donors measured under 3 conditions (made up), with lines joining each donor. Donors differ in overall level, but most show Vehicle < 1 µM < 10 µM. The Friedman test uses only these within-row ranks.

Computing χ²

χ2 = 12nk(k + 1) Σ Rj2 − 3n(k + 1)n = number of rows (subjects), k = number of conditions, R_j = rank sum of condition j. With ties within a row, divide by a correction. P comes from the chi-square distribution with k − 1 degrees of freedom.

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

W = χ2n(k − 1)From 0 to 1: 1 means every row orders the conditions the same way, 0 means no agreement.

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).

ComparisonRank sum diff.zUnadjusted PBonferroniHolm
Vehicle vs 1 µM71.750.0800.2400.160
Vehicle vs 10 µM143.500.000470.00140.0014
1 µM vs 10 µM71.750.0800.2400.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.

Try a Friedman test on a multi-group sampleChoose “Match by row” and Nonparametric to run the Friedman test with χ², P, Kendall’s W, Dunn-type comparisons (Bonferroni or Holm) and a ready-to-paste sentence.
Open for free →

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.

Try a Friedman test on sample dataOpen a multi-group sample on the Graph screen, set Matching to “Match by row” and Test type to Nonparametric to see χ², P, Kendall’s W and Dunn-type comparisons.
Open for free →
Your own data, all the way to the final figure.Loading your files, saving, and journal-ready export (PDF, TIFF, PNG, SVG) are in BenchFig Pro for Windows, updated based on researchers’ requests: ¥3,980/year (2 PCs), with lab and perpetual licenses too.
About the app →

Related guides

Product and journal names are trademarks or registered trademarks of their respective owners.