Friedman Test
Calculator
Learn More
Friedman Test
Definition
Friedman Test is a non-parametric alternative to the one-way repeated measures ANOVA. It tests for differences between three or more matched or paired groups, without requiring normality in the data distribution. The test statistic is based on the ranks of the data values within each block.
The Friedman test is used when the same subjects are measured under different conditions or treatments, and the data is ordinal or continuous. The test is sensitive to differences in the central tendency of the data, but not to differences in variance.
If the Friedman test indicates significant differences between groups, post-hoc tests can be used to determine which groups differ from each other.
Test Statistic
Where:
- = number of blocks (subjects)
- = number of treatments
- = total rank of treatment
- when or
- for better accuracy when and
Key Assumptions
Practical Example
Step 1: State the Data
Scores for three treatments across five subjects:
Subject | Treatment A | Treatment B | Treatment C |
---|---|---|---|
1 | 8 | 6 | 5 |
2 | 7 | 7 | 6 |
3 | 9 | 8 | 6 |
4 | 6 | 5 | 4 |
5 | 7 | 6 | 5 |
Step 2: State Hypotheses
- : No difference between treatments
- : At least two treatments differ
Step 3: Rank Within Blocks
Subject | A | B | C |
---|---|---|---|
1 | 3 | 2 | 1 |
2 | 2.5 | 2.5 | 1 |
3 | 3 | 2 | 1 |
4 | 3 | 2 | 1 |
5 | 3 | 2 | 1 |
14.5 | 10.5 | 5 |
Step 4: Calculate Test Statistic
1. Basic Friedman statistic with b = 5 subjects and k = 3 treatments:
2. Correction for ties:
In our data, we have one tie (7,7) in Subject 2's scores.
where for each group of tied ranks
One pair of ties gives
3. Adjusted test statistic:
Step 5: Draw Conclusion
Critical value for with at is . Since , we reject .
There is sufficient evidence to conclude that there are significant differences between at least two treatments.
With -value = , there is strong evidence to conclude that there are significant differences between at least two treatments.
Effect Size
Kendall's W
Kendall's coefficient of concordance () ranges from (no agreement) to (complete agreement):
For our example:
Interpretation guidelines:
- : Weak agreement
- : Moderate agreement
- : Strong agreement
Code Examples
1#Example data
2data <- matrix(c(8, 6, 5,
3 7, 7, 6,
4 9, 8, 6,
5 6, 5, 4,
6 7, 6, 5),
7 nrow = 5, byrow = TRUE)
8
9# Perform Friedman test
10friedman.test(data)
1import numpy as np
2from scipy.stats import friedmanchisquare
3
4# Example data
5data = np.array([
6 [8, 6, 5],
7 [7, 7, 6],
8 [9, 8, 6],
9 [6, 5, 4],
10 [7, 6, 5]
11])
12
13# Perform Friedman test
14stat, p = friedmanchisquare(data[:, 0], data[:, 1], data[:, 2])
15
16# Output results
17print("Friedman Test Statistic:", stat)
18print("p-value:", p)
Alternative Tests
Consider these alternatives:
- Repeated Measures ANOVA: When normality assumptions hold
- Cochran's Q Test: For binary outcomes
Related Calculators
One-Way ANOVA Calculator
Repeated Measures ANOVA Calculator
Wilcoxon Signed-Rank Test
Chi-Square Test of Independence Calculator
Help us improve
Found an error or have a suggestion? Let us know!