# Friedman test

This page offers all the basic information you need about the friedman test. It is part of Statkat’s wiki module, containing similarly structured info pages for many different statistical methods. The info pages give information about null and alternative hypotheses, assumptions, test statistics and confidence intervals, how to find p values, SPSS how-to’s and more.

To compare the friedman test with other statistical methods, go to Statkat's or practice with the friedman test at Statkat's

##### When to use?

Deciding which statistical method to use to analyze your data can be a challenging task. Whether a statistical method is appropriate for your data is partly determined by the measurement level of your variables. The friedman test requires the following variable types:

 Independent/grouping variable: One within subject factor ($\geq 2$ related groups) Dependent variable: One of ordinal level

Note that theoretically, it is always possible to 'downgrade' the measurement level of a variable. For instance, a test that can be performed on a variable of ordinal measurement level can also be performed on a variable of interval measurement level, in which case the interval variable is downgraded to an ordinal variable. However, downgrading the measurement level of variables is generally a bad idea since it means you are throwing away important information in your data (an exception is the downgrade from ratio to interval level, which is generally irrelevant in data analysis).

If you are not sure which method you should use, you might like the assistance of our method selection tool or our method selection table.

##### Null hypothesis

The friedman test tests the following null hypothesis (H0):

H0: the population scores in any of the related groups are not systematically higher or lower than the population scores in any of the other related groups

Usually the related groups are the different measurement points. Several different formulations of the null hypothesis can be found in the literature, and we do not agree with all of them. Make sure you (also) learn the one that is given in your text book or by your teacher.
##### Alternative hypothesis

The friedman test tests the above null hypothesis against the following alternative hypothesis (H1 or Ha):

H1: the population scores in some of the related groups are systematically higher or lower than the population scores in other related groups
##### Assumptions

Statistical tests always make assumptions about the sampling procedure that's been used to obtain the sample data. So called parametric tests also make assumptions about how data are distributed in the population. Non-parametric tests are more 'robust' and make no or less strict assumptions about population distributions, but are generally less powerful. Violation of assumptions may render the outcome of statistical tests useless, although violation of some assumptions (e.g. independence assumptions) are generally more problematic than violation of other assumptions (e.g. normality assumptions in combination with large samples).

The friedman test makes the following assumptions:

• Sample of 'blocks' (usually the subjects) is a simple random sample from the population. That is, blocks are independent of one another
##### Test statistic

The friedman test is based on the following test statistic:

$Q = \dfrac{12}{N \times k(k + 1)} \sum R^2_i - 3 \times N(k + 1)$

Here $N$ is the number of 'blocks' (usually the subjects - so if you have 4 repeated measurements for 60 subjects, $N$ equals 60), $k$ is the number of related groups (usually the number of repeated measurements), and $R_i$ is the sum of ranks in group $i$.

Remember that multiplication precedes addition, so first compute $\frac{12}{N \times k(k + 1)} \times \sum R^2_i$ and then subtract $3 \times N(k + 1)$.

Note: if ties are present in the data, the formula for $Q$ is more complicated.
##### Sampling distribution

Sampling distribution of $Q$ if H0 were true:

If the number of blocks $N$ is large, approximately the chi-squared distribution with $k - 1$ degrees of freedom.

For small samples, the exact distribution of $Q$ should be used.
##### Significant?

This is how you find out if your test result is significant:

If the number of blocks $N$ is large, the table with critical $X^2$ values can be used. If we denote $X^2 = Q$:
• Check if $X^2$ observed in sample is equal to or larger than critical value $X^{2*}$ or
• Find $p$ value corresponding to observed $X^2$ and check if it is equal to or smaller than $\alpha$
##### Example context

The friedman test could for instance be used to answer the question:

Is there a difference in depression level between measurement point 1 (pre-intervention), measurement point 2 (1 week post-intervention), and measurement point 3 (6 weeks post-intervention)?
##### SPSS

How to perform the friedman test in SPSS:

Analyze > Nonparametric Tests > Legacy Dialogs > K Related Samples...
• Put the $k$ variables containing the scores for the $k$ related groups in the white box below Test Variables
• Under Test Type, select the Friedman test
##### Jamovi

How to perform the friedman test in jamovi:

ANOVA > Repeated Measures ANOVA - Friedman
• Put the $k$ variables containing the scores for the $k$ related groups in the box below Measures