Kruskal Wallis H test

I am doing a Kruskal Wallis H test, it looks like I am getting a significant difference between the non-vegetarian group and the vegan group. But not with the semi-vegetarian group and vegan group.

This is odd because it looks like the difference in medians is larger between the semi-vegetarian group and vegan group, yet it is not significant. But the other comparison that has a smaller median difference is significant. Does anyone know why this would be?

• Indicate briefly your data-type, sample and sampling plan ,? what is purpose your analysis ? – Subhash C. Davar Aug 1 '18 at 10:17
• Even medians can be misleading as summaries, and Kruskal-Wallis isn't a test to see if the medians are different. Can you post the raw data? Can you plot your distributions? – Nick Cox Aug 1 '18 at 13:04
• Another question: do you know what test the software is performing as a post-hoc test? If it's conducting pairwise Wilcoxon-Mann-Whitney tests, these can lead to incommensurant results, or even contradictory results in the case of Schwenk dice. – Sal Mangiafico Aug 1 '18 at 14:51
• To expand on the excellent comment by @SalMangiafico you want to use Dunn's test or the (strictly more powerful, but less known) Conover-Iman test for your post hoc pairwise tests following rejection of the Kruskal-Wallis. – Alexis Aug 1 '18 at 19:35
• Expanding on @NickCox 's excellent comment: the Kruskal-Wallis hypotheses are $H_{0}: P(X_{i} > X_{j}) = 0.5$ for $i \ne j$ and $H_{A}: P(X_{i} > X_{j}) \ne 0.5$. Plainly: the null is that a randomly selected observation from group $i$ has a 0.5 probability of being greater than a randomly selected observation from another group $j$, and the alternative is that for at least one pair of groups $i, j$, this probability is not 0.5. If all groups have the same shape distribution, and if the variances of all groups are equal, the Kruskal-Wallis test is a test for median and mean difference. – Alexis Aug 1 '18 at 19:39