[R] Usage of weights in kruskal_test from package coin
Armin Goralczyk
agoralczyk at gmail.com
Tue Jan 5 20:32:00 CET 2010
With this email I will be following up on this (some months old) post:
http://tolstoy.newcastle.edu.au/R/e7/help/09/06/0799.html
>From this I would assume that the following is also valid:
set.seed(29)
x <- gl(3, 10)
y <- rnorm(length(x), mean = c(0, 0, 1)[x])
d <- data.frame(y = y, x = x)
# w <- rep(2, nrow(d)) ### double each obs
w <- rep(c(1,5), nrow(d)/2)
kruskal_test(y ~ x, data = d[rep(1:nrow(d), w),]) # should be the same as
kruskal_test(y ~ x, data = d, weights = ~ w)
But the tests are not the same. Am I wrong somewhere here?
--
Armin Goralczyk
--
http://www.gwdg.de/~agoralc
More information about the R-help
mailing list