Friedman Test: Full Guide with Example

The Friedman test is a non-parametric statistical test used to detect differences in treatments across multiple test attempts when the data are related (e.g., repeated measures on the same subjects or matched blocks). It is particularly useful when the assumptions for parametric tests like repeated-measures ANOVA (e.g., normality) are not met, or when the data are ordinal.

Assumptions of the Friedman Test:

Hypotheses:

Steps of the Friedman Test:

Step 1: Organize Your Data

Arrange your data in a table where rows represent the subjects (or blocks) and columns represent the different treatment conditions.

Step 2: Rank the Data within Each Block

For each subject (row), rank the observations from lowest to highest across the different treatment conditions (columns). Assign a rank of 1 to the smallest value, 2 to the next smallest, and so on. If there are ties within a row, assign the average of the ranks that would have been assigned.

Step 3: Calculate the Sum of Ranks for Each Treatment

Sum the ranks for each treatment condition (column). Let $R_j$ be the sum of ranks for the $j$-th treatment.

Step 4: Calculate the Friedman Test Statistic ($\chi^2_F$)

The traditional Friedman test statistic, often denoted as $\chi^2_F$ or $Q$, is calculated using the following formula:

$$\chi^2_F = \frac{12}{nk(k+1)} \sum_{j=1}^{k} R_j^2 - 3n(k+1)$$

This statistic approximates a chi-square distribution with $df = k-1$ degrees of freedom.

Step 5: Calculate the F-statistic ($F_F$) (Conover's F-statistic approximation)

An F-statistic approximation can also be used, which follows an F-distribution with degrees of freedom $d1 = k-1$ and $d2 = (n-1)(k-1)$.

$$F_F = \frac{(n-1)\chi^2_F}{n(k-1) - \chi^2_F}$$

Step 6: Determine the Critical Value or P-value

Compare your calculated statistic ($\chi^2_F$ or $F_F$) to the appropriate critical value from a chi-square or F-distribution table, or obtain the p-value using statistical software.

Step 7: Make a Decision

Step 8: Interpret the Results

If you reject the null hypothesis, it means there is a statistically significant difference between at least two of the treatment conditions. Post-hoc tests are needed to identify which specific pairs differ.

Example: Efficacy of Different Pain Relief Methods

A pharmaceutical company wants to compare the effectiveness of three different pain relief methods (A, B, C) for chronic back pain. They recruit 10 patients, and each patient tries all three methods. Patients rate their pain on a scale of 1 to 10 (1 = no pain, 10 = extreme pain).

Significance Level ($\alpha$): 0.05

Original Patient Pain Ratings:

Patient Method A Method B Method C
1754
2867
3643
4976
5532
6765
7854
8653
9743
10864

Step 1: Study Information

Step 2: Ranks within Each Patient (Row)

Patient Method A (Rank) Method B (Rank) Method C (Rank)
1321
2312
3321
4321
5321
6321
7321
8321
9321
10321

Step 3: Sum of Ranks for Each Treatment ($R_j$)

Treatment Sum of Ranks (Rj)
Method A30
Method B19
Method C11

Check: $30 + 19 + 11 = 60$. Expected sum: $n \times k(k+1)/2 = 10 \times 3(4)/2 = 60$. (Correct)

Step 4: Calculate $\chi^2_F$

$$\chi^2_F = \frac{12}{10 \times 3 \times (3+1)} (30^2 + 19^2 + 11^2) - 3 \times 10 \times (3+1)$$

$$\chi^2_F = \frac{12}{120} (900 + 361 + 121) - 120$$

$$\chi^2_F = 0.1 \times (1382) - 120 = 138.2 - 120 = \mathbf{18.2}$$

Step 5: Calculate $F_F$

Degrees of Freedom: $d1 = k-1 = 3-1 = 2$, $d2 = (n-1)(k-1) = (10-1)(3-1) = 9 \times 2 = 18$

$$F_F = \frac{(10-1) \times 18.2}{10(3-1) - 18.2}$$

$$F_F = \frac{9 \times 18.2}{20 - 18.2} = \frac{163.8}{1.8} = \mathbf{91.0}$$

Step 6 & 7: Determine P-values and Make Decision

Step 8: Interpret the Results

Based on the Friedman test (p-value $\approx 0.0001$), we reject the null hypothesis. There is a statistically significant difference in pain relief among the three methods (A, B, and C).

Post-Hoc Analysis (Nemenyi's Test Example)

Since the overall test was significant, we conduct Nemenyi's post-hoc test to see which pairs differ.

Comparison Absolute Difference in Mean Ranks Significance (Difference > CD)
Method A vs. Method B $|3.0 - 1.9| = 1.1$ No
Method A vs. Method C $|3.0 - 1.1| = 1.9$ Yes
Method B vs. Method C $|1.9 - 1.1| = 0.8$ No

Conclusion from Post-Hoc: Only Method A and Method C show a statistically significant difference in pain relief. Method C provides significantly more pain relief than Method A.