Recommended Software for Wilcoxon-Mann-Whitney Test and Associated Confidence Interval

Use the 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'], '-'))
Output:
        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

Topic revision: r2 - 09 Mar 2007, FrankHarrell
 

This site is powered by FoswikiCopyright © 2013-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback