Solved – Why does the Kruskal Wallis test shows a difference but Wilcoxon doesn’t find any between the groups

kruskal-wallis test”post-hocrstatistical significance

Why does the Kruskal Wallis test shows a difference but Wilcoxon doesn´t find any between the groups, even tough the rank medians which are tested as far as I know look very different, and Dunn test as post hoc finds a difference?

Does it have to do with sample size n<5 so no chi-squared distribution?

Here is my test data for R + dunn.test library

test <- data.frame(TR=c("A","B","A","A","C","B","B","C","C","D","D","D"),REP=c(3,1,1,2,3,2,3,1,2,1,3,2),VAL=c(22,88,24,38,24,72,72,29,15,14,21,17))
attach(test)
boxplot(VAL~TR)
TR<-as.factor(TR)
shapiro.test(VAL)
kruskal.test(VAL~TR)
pairwise.wilcox.test(VAL,TR,p.adj='bonferroni')
dunn.test(VAL,TR, method = "bonferroni",altp=TRUE)

Best Answer

The Mann-Whitney-Wilcoxon rank-sum test is inappropriate for post hoc pairwise tests following the rejection of the Kruskal-Wallis null hypothesis because

(1) the rank-sum test uses different rankings of the data than were used in the Kruskal-Wallis test

(2) the rank-sum test does not use the pooled variance estimate implied by the Kruskal-Wallis null hypothesis.

By contrast Dunn's test (and the more powerful Conover-Iman test) do use the same rankings, and do use pooled variance estimates. We would therefore not expect to be surprised when the results of the rank-sum and the actual post hoc tests do differ.