Interpreting Kruskal-Wallis test


New Member
My question arises from a paper I read. Two groups are compared using the non-parametric Kruskal-Wallis test. Neither group has data that is normally distributed. Group A data is skewed low and has a mean that is lower than the median. Group B data is skewed high and has a mean that is higher than the median. Group A has a lower mean but a higher median than group B. The analysis provided in the paper stated the groups are different (p<0.01) by Kruskal Wallis (which in itself surprised me). But they also stated group B had higher results than group A, but that is based on the mean, but if one used the median value you would assume that A was higher than B. Besides showing that the groups are different, does Kruskal Wallis allow you to state which is the higher of the two?


Omega Contributor
KW is typically used with 3 or more groups, not two.

It is based on rank ordering all of the values and seeing if one group had more highly ranked values than the other group. So yeah, I would imagine if you had a significant value you could try to discern which group had more highly ranked observations.


Super Moderator
KW is not a test of equality of medians or means (or it can only be interpreted that way if the shape and spread of the two distributions are identical). It can be interpreted in a broad sense as indicating which population "tends to" have higher values.

More specifically, if we're looking at just two groups (making the KW test equivalent to a Mann-Whitney test), then the null hypothesis being tested is that:

If you randomly select an observation Y1 from Population 1 and randomly select an observation Y2 from Population 2, then the probability that Y2 is greater than Y1 is exactly 0.5.


New Member
Thanks for the responses. The point that Mann Whitney or KW are not tests of mean or median is helpful, they are tests of ranks. But at some point, once a difference is noted between groups, researchers want to assign directionality to the difference. If group A and B are found to have different serum bilirubin by MW test, when writing a paper the researcher will want to state "disease X is characterized by higher (or lower) bilirubin values. In some cases the directionality is obvious. in the case I describe there is large overlap. In order to assign a directionality of the difference, there must be some quantitative way this is done. Is it done by looking at the sum of ranks?


TS Contributor
The sum of ranks will be higher in the sample that tends to have higher values. You can also use boxplots to have a visual "understanding" of which sample is featured by higher values.
For MW you can also compute the 'probability of superiority' statistic: more info HERE



New Member
Thanks to Gianmarco for the comments. Actually, it was the box plot that led me to question the authors comments about which group was higher. The spread of the data in each group was so odd that I believe the author and I came to different conclusions about the data. That is why I was looking for an objective approach to the issue. Again, thanks to all for the comments.


TS Contributor
hi gianmarco,
the probability of superiority is calculated using bootstrap? That could be a great measure for all kinds of two-sample tests I would say. Do you know of other cases where it is used?


TS Contributor
Hello rogojel,
do you mean in general, or in my R code?
The version of PS that I have seen so far is calculated on the basis of the U statistic. I believe that bootstrapping (or better yet, randomizing) PS in order to attach a p value would not be difficult to implement, but I have not the statistical background to say that it would be theoretically sound.
I happen to see the use of PS in a couple of articles, but it would be interesting googling a bit to see what pops up.