# Do we need to report the median or the Mean when using a Kruskal-Wallis test?

I have two groups. There is a significant difference according to the KW test. But do I need to report the mean or median of the groups?

• @MånsT yes this i understand, but I'm confused about which of the two i need to report. – jorrebor Aug 6 '12 at 13:24
• The test determines whether or not there is a location shift in the distribution. As Frank Harrell mentioned, this is not exactly testing for a difference in the median or the mean. Actual vales for medians and means are always worthwhile reporting as well as comparative box plots. The test doesn't have to dictate what other summaries to report when comparing the two distributions. – Michael Chernick Aug 6 '12 at 14:12

The Wilcoxon/Kruskal-Wallis test is not for either the mean or median although the median may be closer to what the test is testing. The estimator that is consistent with the test is the Hodges-Lehmann estimator. See http://en.wikipedia.org/wiki/Mann-whitney and http://en.wikipedia.org/wiki/Hodges%E2%80%93Lehmann_estimate . In R you can do the calculations easily - see for example http://biostat.mc.vanderbilt.edu/WilcoxonSoftware .

• (+1). @jorrebor, you might also take interest to read comments to this answer. – ttnphns Aug 6 '12 at 13:24

The Kruskal-Wallis test is said to test whether the median is the same in every group. According to that simple rule, you should report the median, which is my answer to your question.

However, this gives me the occasion to show that the KW is not really a test of the median. The alternative hypothesis of the test is not that one of the distributions has a different median. It is that one the distributions has exactly the same shape as the others, but is shifted up- or down-wards.

Here is a little R snippet that demonstrates this. I create two samples with the same median (namely 0) and I apply the Kruskal-Wallis test.

set.seed(123)
x <- exp(rnorm(100))
y <- exp(rnorm(100))
x <- x - median(x)
y <- median(y) - y
# Both x and y have median 0.
kruskal.test(list(x,y))


It turns out that the p-value is 0.005676, which seems very low for two samples with exactly the same median. This is because the samples are taken from distributions that are very skewed in opposite directions (the sample x has a heavy tail on the right side and y on the left side).

Is the KW test wrong? No. It is right to reject the null hypothesis that samples are taken from the same distribution.

So the conclusion is that you cannot conclude that there is a difference in median just because you reject the null hypothesis. You might also reject the null hypothesis because of lack of independence, or as shown in the previous example because distributions do not have the same shapes.

I think there is no need to mention all this while reporting the median, but these are elements you should have in mind every time you do the test.

• +1, that's a really nice demonstration; clear & thorough – gung - Reinstate Monica Aug 6 '12 at 16:35