Friedman Test Calculator
The Friedman test compares conditions in repeated measures designs, where the same subjects (or the same blocks) are measured under three or more conditions. It is the non-parametric counterpart of repeated measures ANOVA: it needs neither normality nor sphericity, because each subject's measurements are ranked only within that subject.
This calculator takes a matrix in which each row is a subject and each column a condition; it computes the within-row ranks, builds the Q statistic from the rank sums of the conditions, applies the correction for within-row ties, and gets the p-value from the chi-square distribution. It also reports Kendall's W, which measures how far the subjects agree in their rankings, the complete rank matrix, the condition medians, and — when the result is significant — Bonferroni-corrected pairwise Wilcoxon comparisons.
Friedman Test Formulas
Ranking: Each row (subject) is ranked within itself; ties get the average rank Rank sum: Rⱼ = Σᵢ rᵢⱼ (rank sum of condition j across all subjects) Test statistic: Q = [12·ΣRⱼ² − 3n²k(k+1)²] / [n·k·(k+1)] Tie correction: Denominator = n·k·(k+1) − Σ(t³ − t)/(k − 1) Degrees of freedom: df = k − 1 p-value: p = P(χ²_df > Q) Kendall's W: W = Q / [n(k − 1)] , 0 ≤ W ≤ 1 Expected rank: R̄ⱼ = (k + 1)/2 (under H₀)
Because the Friedman test uses only within-row ranks, general level differences between subjects (some scoring consistently high, others consistently low) do not affect the result. The chi-square approximation is accepted when n ≥ 10 and k ≥ 3. With k = 2 the test reduces to the sign test; in that design the Wilcoxon signed-rank test should be preferred.
How to Calculate
- Write each subject's measurements across all conditions on a single row, in the order of the conditions.
- Make sure every row holds the same number of values; remove any subject with a missing measurement entirely.
- Enter the condition names separated by commas; if their count matches the number of columns, those names are used in the tables and the interpretation.
- Choose the significance level (α); the pairwise comparisons are judged against that level divided by the Bonferroni factor.
- After reading Q, the degrees of freedom, and the p-value, look at Kendall's W: it shows how far the subjects ranked the conditions in the same direction.
- Inspect the rank matrix to see which subjects depart from the overall pattern, and report the Bonferroni-corrected pairwise Wilcoxon comparisons when the result is significant.
Worked Examples
Repeated measures at three time points
The rank sums of 10 subjects are 10, 21, and 29; the mean ranks of 1.00, 2.10, and 2.90 depart clearly from the expected value of 2.00. With Q(2) = 18.200 and p < 0.001, the difference between the conditions is significant. Kendall's W = 0.910 shows that the subjects ranked the conditions in almost exactly the same direction.
Q test statistic (Friedman χ²): 18.200 · Degrees of freedom (df): 2 · p-value: p < 0.001
Four products rated by judges — no difference
In the scores eight judges gave to four products, the rank sums of 18, 22, 20, and 20 are very close to one another, and the mean ranks stay around the expected value of 2.5. Because each judge's row contains equal scores, the correction Σ(t³ − t) = 96 is applied: the uncorrected Q = 0.600 becomes a corrected Q(3) = 0.750, with p = 0.861. With Kendall's W = 0.031 the agreement between the judges is close to nonexistent, meaning the products could not be told apart.
Q test statistic (Friedman χ²): 0.750 · Degrees of freedom (df): 3 · p-value: p = 0.861
Six subjects, three drug doses — a small sample
In all six subjects the measurement fell from placebo toward the high dose: the rank sums are 18, 12, and 6, and the mean ranks 3.00, 2.00, and 1.00. With Q(2) = 12.000 and p = 0.002 the difference is significant, and Kendall's W = 1.000 means perfect agreement. Since the number of subjects is below 10, the calculator shows a warning and recommends confirmation against an exact Friedman table.
Q test statistic (Friedman χ²): 12.000 · Degrees of freedom (df): 2 · p-value: p = 0.002