The Friedman test (named after its originator, the economist Milton Friedman) is a nonparametric ANOVA test similar to the KruskalWallis test, but in this case the columns, k, are the treatments and the rows are not replicates but blocks. This corresponds to a simple twoway ANOVA without replication in a complete block design (for incomplete designs use the Durbin test, which is very similar), but instead of using the original data the values in each row or block, b, are replaced with their ranking within that row/block, i.e. rowwise ranking as compared with columnwise ranking in the KruskalWallis test. The column totals for these ranks are then computed. The statistic then computed is of the form:
where the Ri represent the sum of the ranked values in column i. The statistic is approximately distributed as a chisquare with k1 degrees of freedom. However, a revised (improved) form of the test, defined by:
is widely used, which has an F distribution with (k1) and (b1)(k1) degrees of freedom.
Example: Potato yield data
Using the example provided in the twoway ANOVA section, we have the data shown below, with the row rankings and column sums, followed by the ANOVA table based on the Friedman test statistic provided within MATLab. This form of ANOVA only provides a between columns statistic for evaluation. As with the twoway ANOVA this test does not suggest that any significant column effects exist, i.e. that the different fertilizers have not significantly affected the yield. The test assumes that rows/blocks are independent and that the data can be meaningfully ranked.
Potato yields, in tons  Friedman test

F1 
F2 
F3 
F4 
F5 
Var1 
1.9 (2) 
2.2 (4) 
2.6 (5) 
1.8 (1) 
2.1 (3) 
Var2 
2.5 (4) 
1.9 (1) 
2.3 (3) 
2.6 (5) 
2.2 (2) 
Var3 
1.7 (1) 
1.9 (2) 
2.2 (5) 
2.0 (3) 
2.1 (4) 
Var4 
2.1 (2) 
1.8 (1) 
2.5 (5) 
2.3 (3) 
2.4 (4) 
Sum 
7 
8 
18 
12 
13 
Potato yields  twoway ANOVA  Friedman test
Source 
Sums of squares 
Degrees of freedom 
Mean squares 
Chisq 
Prob>chisq 
Between fertilizers 
15.5 
4 
3.875 
6.2 
0.1847 
Residual 
24.5 
12 
2.042 


Total 
40 
19 


