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

syrvn mentor_ at gmx.net
Tue Jan 10 19:28:04 CET 2012


Hello,


I think I am right in saying that a 2 sample wilcox.test is equal to a 2
sample kruskal.test and

a 2 sample t.test is equal to a 2 sample anova. This is also stated in the
?kruskal.test man page:

The Wilcoxon rank sum test (wilcox.test) as the special case for two
samples; lm together with anova for performing one-way location analysis
under normality assumptions; with Student's t test (t.test) as the special
case for two samples.


>From this example it seems like it doesn't but I cannot figure out what I am
doing wrong.


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

wilcox.test(x,y)
kruskal.test(x,y)
kruskal.test(x~y)
kruskal.test(f~d)

t.test(x,y)
anova(lm(x~y))
summary(aov(lm(x~y)))


And why does kruskal.test(x~y) differ from kruskal.test(f~d)??


Cheers

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



More information about the R-help mailing list