Solved – Can Friedman’s test be used with two samples

friedman testhypothesis testingpaired-comparisonsrepeated measurestwo-sample

When talking about Friedman's test, it commonly comes accompanied by a whole name of "The Friedman's test for three or more correlated samples".

The question is, could results be valid if I apply the Friedman's test to two correlated samples? Or is it strictly mandatory to be three or more?

Considering that the data of those two samples, are completely ok to be used with Friedman's test, and most important, the two samples contain repeated measures, as follows:

popcorn =

5.5000    4.5000    3.5000
5.5000    4.5000    4.0000
6.0000    4.0000    3.0000
6.5000    5.0000    4.0000
7.0000    5.5000    5.0000
7.0000    5.0000    4.5000

"This data comes from a study of popcorn brands and popper type (Hogg 1987). The columns of the matrix popcorn are brands (Gourmet, National, and Generic). The rows are popper type (Oil and Air). The study popped a batch of each brand three times with each popper. The values are the yield in cups of popped popcorn, and using Friedman's test to determine whether the popcorn brand affects the yield of popcorn."

Would it be valid to use Friedman's to determine whether the popcorn brand affects the yield, but only for the Gourmet and National brands? Like this:

popcorn =

5.5000    4.5000    
5.5000    4.5000    
6.0000    4.0000    
6.5000    5.0000    
7.0000    5.5000    
7.0000    5.0000    

Reference: Data and example from here.

Best Answer

A Friedman test could be used on two dependent samples (though some implementations might not allow it, perhaps).

However, note that a Friedman test ranks within blocks. With two dependent samples (i.e. paired data), ranking within the blocks (i.e. allocating either 1, or 2) should be entirely equivalent to a two-tailed sign test (allocating either 0 or 1 whose sum would give the number of positive pair-differences). The only differences would be in things like whether an asymptotic approximation of the distribution was used and in handling of ties.

One advantage of the sign test is that it makes it possible to do a one-sided (one-tailed) test while the Friedman is two-sided.

Consider this example:

       y groups blocks
1  7.775      1      1
2  9.730      1      2
3  7.887      1      3
4  9.739      1      4
5  6.733      1      5
6  9.982      2      1
7  2.787      2      2
8  4.148      2      3
9  6.838      2      4
10 5.897      2      5

Here observations 1 and 6 are paired, as are 2 and 7, and so on. In R, you can actually do the Friedman test with these two groups:

> friedman.test(y,groups,blocks)

        Friedman rank sum test

data:  y, groups, blocks
Friedman chi-squared = 1.8, df = 1, p-value = 0.1797

Note that this implementation uses an asymptotic chi-square approximation, so it won't give exactly the same results as a sign test (a binomial test) unless you use the corresponding normal approximation, and treat ties in the same way (and so on; for example if either uses a continuity correction but the other does not, then that would cause them to differ).

Alternatively it would make sense (especially with such small samples, even more so in data sets with ties) to compute the exact permutation distribution. In that case both the two-tailed sign test and the Friedman test should give identical p-values.

Related Question