Friedman Test Calculator

StatisticsLast updated: August 22, 2026

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.

Write each subject's measurements across all conditions on one row. Every row must hold the same number of values; a subject with missing data has to be removed entirely.
Separate them with commas. If the count does not match the number of columns, "Condition 1, Condition 2…" is used automatically.
Sets the false positive risk. In the social sciences 5% is the common choice.

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

  1. Write each subject's measurements across all conditions on a single row, in the order of the conditions.
  2. Make sure every row holds the same number of values; remove any subject with a missing measurement entirely.
  3. 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.
  4. Choose the significance level (α); the pairwise comparisons are judged against that level divided by the Bonferroni factor.
  5. 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.
  6. 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

Frequently Asked Questions

When should I prefer the Friedman test over repeated measures ANOVA?
Friedman is more trustworthy when the measurements are not normally distributed, when outliers are present, when the number of subjects is small, or when the data are collected on an ordinal scale. It is also an option when the sphericity assumption of repeated measures ANOVA fails, although the Greenhouse-Geisser correction can be used there as well. When the assumptions hold, ANOVA is more powerful.
What does Kendall's W tell you?
W measures how far the subjects ranked the conditions in the same direction: 0 means no agreement at all, 1 means every subject put the conditions in exactly the same order. It is tied directly to Friedman's Q (W = Q/[n(k−1)]) and is reported as the standard effect size of this test. In inter-rater reliability studies, W itself is the quantity of interest.
Q came out significant — how do I find which conditions differ?
A significant Q only says that at least one condition stands apart. The standard route is to run all pairwise comparisons with the Wilcoxon signed-rank test and correct the p-values with Bonferroni; this calculator provides them automatically in the notes. Alternatively, the Nemenyi test can be used: because it keeps the joint ranking, it is more consistent with the Friedman test.
What should I do with subjects that have missing data?
The Friedman test requires a balanced, complete block design: if a single condition is missing for a subject, that subject's entire row has to be removed. Filling the missing cell with a mean distorts the within-row ranks and biases Q. When the share of missing data is high, mixed effects models are the better solution.
Can I use the Friedman test with two conditions?
You can, but it is not recommended: with k = 2 the Friedman test reduces to the sign test and ignores the sizes of the differences entirely. In that design the Wilcoxon signed-rank test is both more powerful and gives an effect size with a confidence interval. Friedman shows its real value with three or more conditions.
How do I get the same result in SPSS and R?
In SPSS, choose the k samples option under Analyze → Nonparametric Tests → Related Samples; the output gives the Friedman chi-square, the degrees of freedom, and the asymptotic p. In R, friedman.test(matrix) produces the same values, with the matrix arranged so that rows are subjects and columns are conditions. For Kendall's W, use the KendallW function from the DescTools package.
How do within-row ties affect the result?
When a subject records the same value in two conditions, those conditions receive the average rank and the denominator of Q is reduced by Σ(t³ − t)/(k − 1); this correction increases Q. Without the correction the p-value comes out larger than it should be. This calculator applies the correction automatically and also shows the uncorrected Q.