# Different results between Kruskal-wallis test and multiple comparison after Kruskal-w

#### maria isabel

##### New Member
Hello all,

I used Kruskal Wallis test to compare three data groups pra testar comparações em três grupos (b,c,s). The p-valor was < 0,05 in all cases (So, there is difference among at least two groups ). So, I compared pair the paires of groups (to know how groups are different) and it retruned FALSE in all comparisons oO.

> c = c(0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
> s = c(0,1,0,1,0,1,0,5,12,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,2,0,0,0,1,1,1,0,0,0,0,1,0,1);
> b = c(7,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0);
> kruskal.test(list(b,c,s));

Kruskal-Wallis rank sum test

data: list(b, c, s)
Kruskal-Wallis chi-squared = 12.0952, df = 2, p-value = 0.002364

> categ = factor(rep(1:3,c(20,40,40)),labels = c("g1","g2","g3"));
> data = c(b,c,s);
> kruskalmc(data,categ);
Multiple comparison test after Kruskal-Wallis
p.value: 0.05
Comparisons
obs.dif critical.dif difference
g1-g2 6.225 19.02047 FALSE
g1-g3 8.475 19.02047 FALSE
g2-g3 14.700 15.53015 FALSE

I didn´t understand those results. It is inconsistent. So, I used U Test with the objective of compare two groups of each time.

wilcox.test(b,c);

Wilcoxon rank sum test with continuity correction

data: b and c
W = 449.5, p-value = 0.07556
alternative hypothesis: true location shift is not equal to 0

Warning message:
cannot compute exact p-value with ties in: wilcox.test.default(b, c)
> wilcox.test(b,s);

Wilcoxon rank sum test with continuity correction

data: b and s
W = 332.5, p-value = 0.1742
alternative hypothesis: true location shift is not equal to 0

Warning message:
cannot compute exact p-value with ties in: wilcox.test.default(b, s)
> wilcox.test(c,s);

Wilcoxon rank sum test with continuity correction

data: c and s
W = 564.5, p-value = 0.0006209
alternative hypothesis: true location shift is not equal to 0

Like you can see, one of comparisons returned c and s groups are statically different. So, please, what can I conclude?

#### Karabiner

##### TS Contributor
Re: Different results between Kruskal-wallis test and multiple comparison after Krusk

This certainly is not an SPSS question, so I suppose that either
you should ask it in the sub-forum appropriate for the software
you used, or in the "statistics" sub-forum?

With kind regards

K.

#### gianmarco

##### TS Contributor
Re: Different results between Kruskal-wallis test and multiple comparison after Krusk

Hi!
Waiting for moderators to move this thread into another Forum's section, I would try to help the user.

I would stick with the result of the KW test, which I think is done in R.

I am not familiar with that test made in R, but I guess that the problem is that while a significant difference is spotted, the post hoc test is not able to spot where the significant difference lies because the standardized absolute rank differences on which the pairwise p values are bases are not corrected for ties in the data.

Due to this, the individual p values will not achieve the significance "threshold" of 0.017 as dictated by the Bonferroni correction (0.05/3 comparisons= 0.017).

If the standardized rank differences are corrected for ties, then the difference between c and s is significant.

Please, take a look at the attached pdf reporting the test's results after a Minitab macros.

Hope this helps,
Regards
Gm

#### maria isabel

##### New Member
Re: Different results between Kruskal-wallis test and multiple comparison after Krusk

Thanks, Karabiner.

Gianmarco, thanks very much for observation. I saw the pdf file. The result was similar to Wilcox tests. In other words, always I have these situation of inconsistence of Kruskal and Multiple comparison afters Kruskall wallis, I can consider to perform WIlcox test for each pair of data? Please, answer to me at [mod: extra thread deleted]

Last edited by a moderator:

#### CB

##### Super Moderator
Re: Different results between Kruskal-wallis test and multiple comparison after Krusk

Hi maria isabel, I have moved this thread to the R subforum and deleted your other post.

#### gianmarco

##### TS Contributor
Re: Different results between Kruskal-wallis test and multiple comparison after Krusk

Hi Maria,
I do not know how to tackle the issue of the inconsistency between KW and post hoc test. I see, for instance, that the Minitab macro I used set the alpha level at 0.20 by default, may be in order not to lower down too much the Bonferroni corrected individual alpha. By the way, if alpha is set at 0.20, than the Dunn test "manage" to find the significant difference between the aforementioned samples of yours.
I do not know, however, if this strategy is statistically sound. May be other users or moderators can provide a sounder guidance on this.

As for the use of MW, I believe that you can use it in a pairwise fashion instead of KW. For instance, this is what is done by the free spreadsheet-like stats program called Past (link).

Hope this helps
Cheers
Gm