# Friedman's test and post-hoc analysis

I am carrying out a statistical analysis for my research. I am using a Friedman's test with post hoc analysis. At present I am using the function friedman.test.with.post.hoc available for R software. This function reports "maxT" value instead of the chi-square value. Someone can explain me what is maxT and its relationship with Chi-square?

Thank you.

• If you're referring to the function defined at r-statistics.com/2010/02/… (@chl's link doesn't work for me): the function performs permutation tests on the pairwise comparisons by calling symmetry_test() from package coin. symmetry_test() lets you choose different test statistics which are explained in vignette("coin_implementation") - Tmax is one of them. Beware that this is a technical read about the implementation of permutation tests. – caracal May 4 '11 at 15:51

As @caracal's said, this script implements a permutation-based approach to Friedman's test with the coin package. The maxT procedure is rather complex and there is no relation with the traditional $\chi^2$ statistic you're probably used to get after a Friedman ANOVA. The general idea is to control the FWER. Let's say you perform 1000 permutations, for every variable of interest, then you can derive not only pointwise empirical p-values for each variable (as you would do with a single permutation test) but also a value that accounts for the fact that you tested all those variables at the same time. The latter is achieved by comparing each observed test statistic against the maximum of permuted statistics over all variables. In other words, this p-value reflects the chance of seeing a test statistic as large as the one you observed, given you've performed as many tests. More information (in a genomic context, and with algorithmic considerations) can be found in

Dudoit, S., Shaffer, J.P., and Boldrick, J.C. (2003). Multiple Hypothesis Testing in Microarray Experiments. Statistical Science, 18(1), 71–103.

(Here are some slides from the same author with applications in R with the multtest package.)

Another good reference is Multiple Testing Procedures with Applications to Genomics, by Dudoit and van der Laan (Springer, 2008).

Now, if you want to get more "traditional" statistic, you can use the agricolae package which has a friedman() function that performs the overall Friedman's test followed by post-hoc comparisons.

The permutation method yields a maxT=3.24, p=0.003394, suggesting an overall effect of the target when accounting for the blocking factor. The post-hoc tests basically indicate that only results for Wine A vs. Wine C (p=0.003400) are statistically different at the 5% level.

Using the non-parametric test, we have

> library(agricolae)
> with(WineTasting, friedman(Taster, Wine, Taste, group=FALSE))
Friedman's Test
===============
Value: 11.14286
Pvalue chisq : 0.003805041
F value : 7.121739
Pvalue F: 0.002171298

Alpha     : 0.05
t-Student : 2.018082

Comparison between treatments
Sum of the ranks

Difference   pvalue sig   LCL   UCL
Wine A - Wine B          6 0.301210     -5.57 17.57
Wine A - Wine C         21 0.000692 ***  9.43 32.57
Wine B - Wine C         15 0.012282   *  3.43 26.57


The two global tests agree and basically say there is a significant effect of Wine type. We would, however, reach different conclusions about the pairwise difference. It should be noted that the above pairwise tests (Fisher's LSD) are not really corrected for multiple comparisons, although the difference B-C would remain significant even after Holm's correction (which also provides strong control of the FWER).