coin
package in R
which also requires the modeltools
and mvtnorm
packages. Here is an example:
library(coin) y <- c(1, 2, 2, 2, 2, 4, 2, 5, 8, 16) g <- factor(c(1,1,1,1,1,1,2,2,2,2)) wilcox_test(y ~ g, conf.int=TRUE, distribution='exact') # omit distribution to get asymptotic # Get location estimate another way median(outer(y[g=='1'], y[g=='2'], '-'))
Exact Wilcoxon Mann-Whitney Rank Sum Test data: y by groups 1, 2 Z = -2.0469, p-value = 0.07619 alternative hypothesis: true mu is not equal to 0 95 percent confidence interval: -14 0 sample estimates: difference in location -4 [1] -4