# Friedman Test

The Friedman Test is a statistical test used to compare the means of three or more related groups. It is a non-parametric alternative to the one-way ANOVA test and is particularly useful for analyzing data that does not meet the assumptions of normality or equal variances. The test ranks the data within each group and then compares the average ranks between groups to determine if there is a significant difference. This test is commonly used in social sciences, psychology, and business research. It is named after its developer, the American economist and statistician, Milton Friedman.

## What is the Friedman Test?

The Friedman Test is a statistical test used to determine if 3 or more measurements from the same group of subjects are significantly different from each other on a skewed variable of interest. Your variable of interest should be continuous, and have a similar spread across your groups. Also, you should have enough data (more than 5 values in each group).

The Friedman Tests is also sometimes called the Non-Parametric Repeated Measures ANOVA, Non-Parametric Friedman Test, or the Friedman Rank Sum Test.

## Assumptions for the Friedman Test

Every statistical method has assumptions. Assumptions mean that your data must satisfy certain properties in order for statistical method results to be accurate.

The assumptions for the Friedman Test include:

1. Continuous
2. Random Sample
3. Enough Data

Let’s dive in to each one of these separately.

#### Continuous

The variable that you care about (and want to see if it is different across the 3+ groups) must be continuous. Continuous means that the variable can take on any reasonable value.

Some good examples of continuous variables include age, weight, height, test scores, survey scores, yearly salary, etc.

If your variable is normally distributed, you may want to use a One-Way Repeated Measures ANOVA instead.

#### Random Sample

The data points for each group in your analysis must have come from a simple random sample. This means that if you wanted to see if drinking sugary soda makes you gain weight, you would need to randomly select a group of soda drinkers for your soda drinker group.

The key here is that the data points for each group were randomly selected. This is important because if your groups were not randomly determined then your analysis will be incorrect. In statistical terms this is called bias, or a tendency to have incorrect results because of bad data.

If you do not have a random sample, the conclusions you can draw from your results are very limited. You should try to get a simple random sample.If you have independent samples (3 measurements from different, unrelated groups) then you should use the Kruskal-Wallis One-Way ANOVA instead.

#### Enough Data

The sample size (or data set size) should be greater than 5 in each group. Some people argue for more, but more than 5 is probably sufficient.

The sample size also depends on the expected size of the difference across groups. If you expect a large difference across groups, then you can get away with a smaller sample size. If you expect a small difference across groups, then you likely need a larger sample.

## When to use the Friedman Test?

You should use the Friedman Test in the following scenario:

1. You want to know if many groups are different on your variable of interest
2. Your variable of interest is continuous
3. You have 3 or more groups
4. You have related samples

Let’s clarify these to help you know when to use the Friedman Test.

#### Difference

You are looking for a statistical test to see whether three or more groups are significantly different on your variable of interest. This is a difference question. Other types of analyses include examining the relationship between two variables (correlation) or predicting one variable using another variable (prediction).

#### Continuous Data

Your variable of interest must be continuous. Continuous means that your variable of interest can basically take on any value, such as heart rate, height, weight, number of ice cream bars you can eat in 1 minute, etc.

Types of data that are NOT continuous include ordered data (such as finishing place in a race, best business rankings, etc.), categorical data (gender, eye color, race, etc.), or binary data (purchased the product or not, has the disease or not, etc.).

#### Three or more Groups

The Friedman Test can be used to compare three or more related groups on your variable of interest. See below for an explanation of what “related” groups means.

If you have only two groups, you should use the Wilcoxon Signed-Rank Test instead.

#### Related Samples

Related samples means that you have repeated measures from the same units of observation. For example, if you have a group of men undergoing a treatment and you measure their cholesterol levels at 3 time points, then you have 3 groups of related data.

If you have 3 or more independent groups, you should use a Kruskal-Wallis One-Way ANOVA instead.

## Friedman Test Example

Scenario: A random sample of men undergo an exercise program
Repeated Measures: Data were collected at month 1, 2 and 3
Variable of interest: Cholesterol levels

In this example we have three related groups (the three points in time) and one continuous variable of interest. After investigating our data, we determine that our variable of interest, cholesterol levels, is positively skewed, so we know to perform the Friedman Test. After confirming that our data meet the other assumptions of this test, we proceed with the analysis.

The null hypothesis, which is statistical lingo for what would happen if the exercise program does nothing, is that none of the three groups have different cholesterol levels, on average. We are trying to determine if receiving any of the three time points is significantly different from the others.

After the experiment is over, we compare the three groups on our variable of interest (cholesterol levels) using a Friedman Test. When we run the analysis, we get a “Chi-sqaure” statistic and a p-value. The Chi-square statistic is a measure of how different the three groups are on our cholesterol variable of interest.

A p-value is the chance of seeing our results assuming that the exercise program has no effect on cholesterol levels. A p-value less than or equal to 0.05 means that our result is statistically significant and we can trust that the difference is not due to chance alone.

If the Chi-square statistic is high and the p-value is low, it means that the cholesterol levels were significantly different in at least one of the time points. Further investigation is required to determine the which group(s) was significantly higher/lower than the others.

x