Skip to the content.

Friedman test

The Friedman test is a non-parametric statistical test used to compare the mean ranks of three or more related groups. It is similar to the one-way repeated measures ANOVA, but is used when the assumptions of normality and equal variances are not met.

“Whoa, whoa, wait a second!” I hear you exclaim, “That’s what you said about the Kruksal-Wallis test too!”

TL;DR The Friedman test is used for related groups with ordinal data, while the Kruskal-Wallis test is used for independent groups with ordinal data.

You would be right but there are a couple of key differences between the Friedman test and the Kruskal-Wallis test.

The null hypothesis of the Friedman test is that there is no difference in the mean ranks of the groups.

The alternative hypothesis is that at least one group has a different mean rank than the others.

Example of when and how to use a Friedman tests

Imagine you are a music producer who wants to compare the popularity of three different music genres: hip-hop, rock, and country. You have surveyed 10 music fans and asked them to rate their preference for each genre on a scale of 1 to 10. You want to know if there is a significant difference in the mean preference for each genre, so you decide to use the Friedman test.

Your data should look something like this:

  Hiphop Country EDM
Person 1 6 3 8
Person 2 7 4 7
Person 3 8 5 9
Person 4 4 6 5
Person 5 5 2 6
Person 6 6 4 7
Person 7 7 5 8
Person 8 8 3 6
Person 9 4 5 8
Person 10 5 7 8

As you analyze the data, you notice that hip-hop is the most popular genre among young people, while rock is more popular among older fans. You also notice that there are some fans who rate all three genres equally, while others have a strong preference for one over the others.

When you run the Friedman test, the p-value returned is < 0.05 indicating a significant difference in the mean preference for each genre, indicating that some genres may be more popular than others among music fans. HOWEVER, you do not know who is different until you apply a post hoc test.

Post hoc test

The most common post-hoc test for the Friedman test is the Wilcoxon signed-rank test. Briefly, the Wilcoxon signed-rank is a nonparametric test that can be effective at determining if paired data have different means. Much like the post hoc Tukey test following an ANOVA or a Dunn’s test following a Kruskal-Wallis test, you MUST perform the Wilcoxon signed-rank test to identify WHICH groups are different.

Visualizing the results

Just because you ran the analysis in JMP does not mean you have to use JMP to visualize your results. As long as you have a statistically significant result you can generate the plots however you would like (e.g., Excel, Google Sheets, R, Python). All you need to do is add an annotation to the figure that the P-value was < 0.05. A box-and-whisker plot would be a good way of visualizing the results of a Friedman test. The box-and-whisker plot would present both the spread of the data while also incorporating error bars associated with the mean calculation.