Friedman and Cochran Q Tests


Menu locations:
Analysis_Analysis of Variance_Friedman
Analysis_Nonparametric_Cochran Q


This method compares several related samples and can be used as a nonparametric alternative to the two way ANOVA.


The power of this method is low with small samples but it is the best method for nonparametric two way analysis of variance with sample sizes above five.


The Iman-Davenport T2variant of the Friedman test statistic is:

- where there are k treatments and b blocks and T1 is:

- where Rj is the sum of the ranks (from pooled observations) for all blocks in a one treatment and A1 and C1 are:




The null hypothesis of the test is that the treatments have identical effects. The alternative hypothesis is that at least one of the treatments tends to yield larger values than at least one of the other treatments.


When the test is significant StatsDirect allows you to make multiple comparisons between the individual samples. These comparisons are performed automatically for all possible contrasts and you are informed of the statistical significance of each contrast. A contrast is considered significant if the following inequality is satisfied:

- where t is a quantile from the Student t distribution on (b-1)(k-1) degrees of freedom. This method is a nonparametric equivalent to Fisher's least significant difference method (Conover, 1999).


An alternative to the Friedman test is to perform two way ANOVA on ranks; this is how the T2 statistic was derived.


Cochran's Q, Kendall's W and Quade

Kendall's W coefficient of concordance test (also attributed to Wallis and Babington-Smith independently) gives the same numerical answers as Friedman's test.


Quade's proposed a slightly different method for testing the same hypotheses as described above for Friedman's method. Friedman's test generally performs better than Quade's test and should be used instead.


Cochran's Q test can be performed using this Friedman test function by entering dichotomous data coded as in the example below (Conover, 1999):


Game 1 2 3
1 1 1 1
2 1 1 1
3 0 1 0
4 1 1 0
5 0 0 0
6 1 1 1
7 1 1 1
8 1 1 0
9 0 0 1
10 0 1 0
11 1 1 1
12 1 1 1


- here Conover (1999) describes how three people ran their own separate scoring systems for predicting the outcomes of basketball games; the table above shows 1 if they predicted the outcome correctly and 0 if not for 12 games. Whenever binary data is used StatsDirect will run the Cochran variant of this test - providing the T1 statistic above, which is equal to Q. If there are fewer than 25 blocks with at least one observation then the chi-square approximation may be weak, therefore you should select the "Simulate Exact P" option.


Technical Validation

The overall test statistic is T2 calculated as above (Iman and Davenport, 1980). T2 is approximately distributed as an F random variable with k-1 numerator and (b-1)(k-1) denominator degrees of freedom, this is how the P value is derived. Older literature and some software uses an alternative statistic that is tested against a chi-square distribution, the method used in StatsDirect is more accurate (Conover, 1999). A simulated exact P is provided as an option - this permutes the blocks at random and provides a Monte Carlo P value with the margin of simulation error expressed as a 99% confidence interval.



From Conover (1999, p. 372).

Test workbook (ANOVA worksheet: Grass 1, Grass 2, Grass 3, Grass 4).


The following data represent the rank preferences of twelve home owners for four different types of grass planted in their gardens for a trial period. They considered defined criteria before ranking each grass between 1 (best) and 4 (worst).


Grass 1 Grass 2 Grass 3 Grass 4
4 3 2 1
4 2 3 1
3 1.5 1.5 4
3 1 2 4
4 2 1 3
2 2 2 4
1 3 2 4
2 4 1 3
3.5 1 2 3.5
4 1 3 2
4 2 3 1
3.5 1 2 3.5


To analyse these data in StatsDirect you must first prepare them in four workbook columns appropriately labelled. Alternatively, open the test workbook using the file open function of the file menu. Then select Friedman from the Nonparametric section of the analysis menu. Then select the columns marked "Grass 1", "Grass 2", "Grass 3" and "Grass 4" in one selection action. Then after the first set of results are shown select "Friedman multiple comparisons" from the Further analysis box and click Run.


For this example:


T2 = 3.192198 P = 0.0362


All pairwise comparisons (Conover)

Grass 1 vs. Grass 2, P = 0.0149

Grass 1 vs. Grass 3, P = 0.0226

Grass 1 vs. Grass 4, P = 0.4834

Grass 2 vs. Grass 3, P = 0.8604

Grass 2 vs. Grass 4, P = 0.0717

Grass 3 vs. Grass 4, P = 0.1017


From the overall test statistic we can conclude that there is a statistically significant tendency for at least one group to yield higher values than at least one of the other groups. Considering the raw data and the contrast results we see that grasses 2 and 3 are significantly preferred above grass 1 but that there is little to choose between 2 and 3.


P values

analysis of variance