# Friedman test

**Friedman test is part of:**

### Principles of the Friedman test

The Friedman test is a non-parametric alternative to the ANOVA with two factors where the assumption of normality is not acceptable. It is used to test if k paired samples (k>2) of size n, come from the same population or from populations having identical properties as regards the position parameter. As the context is often that of the ANOVA with two factors, we sometimes speak of the Friedman test with k treatments and n blocks.

Use the Friedman's test when you have k paired samples corresponding to k treatments concerning the same blocks, in order to illustrate a difference between the treatments.

### Friedman test definition

If M_{i} is the position parameter for sample i, the null H_{0} and alternative H_{a} hypotheses for the Friedman test are as follows:

**H**_{0}: M_{1}= M_{2}= … = M_{k}**H**_{a}: There is at least one pair (i, j) such that M_{i}≠ M_{j}

Let n be the size of k paired samples. The Q statistic from the Friedman test is given by:

Q = 12/(nk(n+1)) Σ_{i=1..k} [R_{i}²-3n(k+1)]

where R_{i} is the sum of the ranks for sample i.

Where there are ties, the average ranks are used for the corresponding observations.

The p-value associated with a given value of Q can be approximated by a Chi² distribution with (k-1) degrees of freedom. This approximation is reliable when kn is greater than 30, the quality also depending on the number of ties. The p-values associated with Q have been tabulated for (k = 3, n = 15) and (k = 4, n = 8) (Lehmann 1975, Hollander and Wolfe 1999).

When the p-value is such that the H_{0} hypothesis has to be rejected, then at least one sample (or group) is different from another. To identify which samples are responsible for rejecting H_{0}, multiple comparison procedures can be used.

### Multiple comparison for the Friedman test

For the Friedman test, one multiple comparison method is available, the Nemenyi method (1963). This method is similar to the one of Dunn, but takes into account the fact that the data are paired.