StatsToDo : Friedman's Two Way Analysis of Variance
for Non-parametric Data. Explanation and Calculations
Introduction Javascript Program R Code
Friedman's Two Way Analysis of Variance is a method to compare matched samples in multiple groups, where the data is nonparametric. It is the nonparametric equivalent of the Two Way Analysis of Variance, and similar to Wilcoxon's Matched Pair Ranks Test, except that there is usually more than 2 matched groups.

The advantage of Friedman's Test over unpaired comparison such as Kruskall Wallace One Way Analysis of Variance is that the comparison between groups are carried out within each case, so that variance between cases are bypassed.

The data to be entered consists of a multiple column table, where the columns represent groups, and the rows individual cases. The number in each cell is the ranking from the row subject to the column group.

Actual measurements can be used, providing the units measure the same thing across the groups, and the data in each trow are ranked before the statistics are calculated.

### Example

The use of the method and interpretation of results are best demonstrated by the example provided in Javascript panel

 A1 A2 A3 A4 2 4 1 3 1 3 2 4 3 1 2 4 1 1 2 3 1 2 3 4 2 3 1 4 1 2 3 4 1 2 4 3 2 3 1 4 3 1 4 2 1 1 3 4 3 1 2 4 3 4 1 2 3 4 1 2 2 1 3 4 1 1 4 3 1 2 4 3

We want to compare pain relieve medication for chronic arthritis sufferers. We have 4 analgesics (A1, A2, A3, and A4). We recruited 17 arthritis sufferers, and treat them with the 4 medications in random order, then ask each sufferer to comparatively rate the effectiveness of pain relief, from 1 for poorest to 4 the best. If a sufferer cannot distinguish between medications, then the same rating can be given to more than one medication.

The table to the left show the rating provided by the 17 sufferers to the 4 analgesics.

 2 4 1 3 1 3 2 4 3 1 2 4 1.5 1.5 3 4 1 2 3 4 2 3 1 4 1 2 3 4 1 2 4 3 2 3 1 4 3 1 4 2 1.5 1.5 3 4 3 1 2 4 3 4 1 2 3 4 1 2 2 1 3 4 1.5 1.5 4 3 1 2 4 3 2.5 4 1 2.5 1 4 3 2 1 2 4 3 1 4 3 2 Sum Ranks 38 51.5 53 67.5 Mean Ranks 1.8095 2.4524 2.5238 3.2143

The program firstly re-ranks the data, as shown in the table to the right to the right. Each row is ranked from 1 to 4 for the 4 groups. Where there are ties, the ranks are averaged.

The table is then summarised as a table of counts, where the numbers for each rank in each group are shown. This provides a better visual interpretation of how the preferences are distributed, and the numbers can be used to produce graphics such as bar charts.

The first statistics is to test the data against the null hypothesis that there is no difference between the groups. From this set of data, F=12.7136, df = 3, p=0.0053, so the differences between the groups are statistically significant.

The second analysis should be carried out only if a significant difference is found. It is a post hoc analysis to see which pair of groups are significantly different.

The calculation produces the least significant difference in sum of ranks between the groups. From this set of data, this is 22.1 at the p=0.05 level, and 26.3 at the p=0.01 level. Differences between any two groups exceeding these values are statistically significant.

From our data, the only pair that is different is between analgesic 1 and 4. The sum of ranks for A1 is 38 and for A4 is 67.5, a difference of 29.5, which is larger than the least significant difference at the p=0.01 level of 26.3. We can therefore conclude that arthritis sufferers prefer analgesic 4 more than analgesic 1, but no conclusions can be drawn on other comparisons.

References

Siegel S and Castellan Jr. N.J. Nonparametric Statistics for the Behavioral Sciences (1988) International Edition. McGraw-Hill Book Company New York. ISBN 0-07-057357-3 p. 174-183

Siegel S and Castellan Jr. N.J. Nonparametric Statistics for the Behavioral Sciences (1988) International Edition. McGraw-Hill Book Company New York. ISBN 0-07-057357-3 Table M. Critical values for Friedman's F for small samples p. 353