# Can Friedman's test be used with two samples?

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.

• stats.stackexchange.com/a/83907/3277 is one of possible answers. Search Friedman on this site for more. Sep 3, 2016 at 21:00
• I have done that but haven't find the answer :(. The link is with regards to select either Wilcoxon or Friedman's test. This is a question of knowing if Friedman's can be used or not with two samples. Sep 3, 2016 at 21:09
• Wilcoxon needs data to be indepent observations, here the data is dependent on the first three observations. So far, the only test to be used with replicated observations (blocks) is the Friedman's test, but then, I don't know if that would be ok to use it for two samples. Sep 3, 2016 at 21:15
• Pardon me for not explaining it in the comment: I was expecting more perspicacity from your side. In the linked answer, It is said that Friedman performed on 2 related samples is (almost) equivalent to sign test, a well-known paired-sample test; from which it follows that of course you may do Friedman on just 2 samples. Wilcoxon needs data to be indepent observations - it is Wilcoxon-Mann-Whitney, not Wilcoxon (which is a paired-samples test), don't confuse them. Sep 3, 2016 at 21:33
• By independent observations I don't mean samples. Mann-Whitney requires independent samples, Wilcoxon signed rank test requires dependent samples, but independent observations. I cannot use a sign-test because it also requires independent observations. That is why I need to know if Friedman's is valid to be used with two samples or not. I need a test for two non-parametric samples, dependent with dependent observations. Sep 3, 2016 at 21:59

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.

• Outstanding answer. Many think that Friedman's test generalizes Wilcoxon's signed rank test to multiple samples. But as you pointed out - it is not (that would rather be the Quade test). Sep 4, 2016 at 10:32