LE PAPE Gilles <lepape.gilles <at> neuf.fr> writes: > > Could somebody explain me why the pairwise.wilcox.test > function ever gives the same result with either "paired=FALSE" or > "paired=TRUE" ?
Because of what I would consider a .. let's call it feature to avoid flames... in parameter passing in pairwise.wilcox.test. #---------------------------------------------- x = rnorm(100) g = as.factor(rep(letters[1:4],25)) pairwise.wilcox.test <- function (x, g, p.adjust.method = p.adjust.methods, paired = FALSE,...) { p.adjust.method <- match.arg(p.adjust.method) DNAME <- paste(deparse(substitute(x)), "and", deparse(substitute(g))) g <- factor(g) METHOD <- if (paired) "Wilcoxon signed rank test" else "Wilcoxon rank sum test" compare.levels <- function(i, j) { xi <- x[as.integer(g) == i] xj <- x[as.integer(g) == j] # was wilcox.test(xi, xj, ...)$p.value wilcox.test(xi, xj, paired=paired,...)$p.value } PVAL <- pairwise.table(compare.levels, levels(g), p.adjust.method) ans <- list(method = METHOD, data.name = DNAME, p.value = PVAL, p.adjust.method = p.adjust.method) class(ans) <- "pairwise.htest" ans } wp = pairwise.wilcox.test(x,g,paired=FALSE,p.adjust.method="none") wup = pairwise.wilcox.test(x,g,paired=TRUE,p.adjust.method="none") ______________________________________________ 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.