See the respective help files. The continuity correction only affects
the normal approximation in wilcox.test. With this small samples sizes,
the default evaluation is exact, so it doesn't change anything. In
contrast, kruskal.test is incapable to compute exact values but always
uses the chi-square approximation. So the discrepancy is between exact
test and approximation (guess you'd be better off with the former).

If you get the urge to reproduce the p value from kruskal.test using
wilcox.test, and maybe to better understand what's happening, try

a <- wilcox.test(x1, x2, paired=FALSE, exact=FALSE, correct=FALSE)

(and yes, now with exact=FALSE, the continuity correction makes a
difference).

HTH, Michael

> -----Original Message-----
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of David Scott
> Sent: Dienstag, 8. September 2009 07:02
> To: Thomas Farrar
> Cc: r-help@r-project.org
> Subject: Re: [R] Equivalence of Mann-Whitney test and 
> Kruskal-Wallis test with k=2
> 
> Thomas Farrar wrote:
> > Hi all,
> > 
> > The Kruskal-Wallis test is a generalization of the two-sample 
> > Mann-Whitney test to *k* samples.  That being the case, the 
> > Kruskal-Wallis test with *k*=2 should give an identical 
> p-value to the Mann-Whitney test, should it not?
> > 
> > x1<-c(1:5)
> > x2<-c(6,8,9,11)
> > a<-wilcox.test(x1,x2,paired=FALSE)
> > b<-kruskal.test(list(x1,x2),paired=FALSE)
> > a$p.value
> > [1] 0.01587302
> > b$p.value
> > [1] 0.01430588
> > 
> > The p-values are slightly different (note that there are no ties in 
> > the data, so computed p-values should be exact).
> > 
> > Can anyone explain the discrepancy?  It's been awhile since 
> I studied 
> > nonparametric stats and this one has me scratching my head.
> > 
> > Many thanks!
> > Tom
> > 
> 
> The continuity correction? It is true by default for 
> wilcox.test and is not apparent in the help for kruskal.test.
> 
> David Scott
> 
> --
> _________________________________________________________________
> David Scott   Department of Statistics
>               The University of Auckland, PB 92019
>               Auckland 1142,    NEW ZEALAND
> Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
> Email:        d.sc...@auckland.ac.nz,  Fax: +64 9 373 7018
> 
> Director of Consulting, Department of Statistics
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to