[R] 2 sample wilcox.test != kruskal.test

syrvn mentor_ at gmx.net
Wed Jan 11 11:36:16 CET 2012


Hi,

thanks for your answer. Unfortunately I cannot reproduce your results.

In my example the results still differ when I use your approach:

> x <- c(10,11,15,8,16,12,20)
> y <- c(10,14,18,25,28,30,35)
> f <- as.factor(c(rep("a",7), rep("b",7)))
> d <- c(x,y)
> kruskal.test(x,y)

	Kruskal-Wallis rank sum test

data:  x and y 
Kruskal-Wallis chi-squared = 6, df = 6, p-value = 0.4232

> kruskal.test(x~y)

	Kruskal-Wallis rank sum test

data:  x by y 
Kruskal-Wallis chi-squared = 6, df = 6, p-value = 0.4232

> kruskal.test(d~f)

	Kruskal-Wallis rank sum test

data:  d by f 
Kruskal-Wallis chi-squared = 3.6816, df = 1, p-value = 0.05502

> kruskal.test(f~d)

	Kruskal-Wallis rank sum test

data:  f by d 
Kruskal-Wallis chi-squared = 11.1429, df = 12, p-value = 0.5167


I know the last kruskal.test(f~d) is not correct as the factor is always
placed as the second bit but I still tried it that way just to be sure...

Cheers


--
View this message in context: http://r.789695.n4.nabble.com/2-sample-wilcox-test-kruskal-test-tp4282888p4285003.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list