[R] help comparing two median with R

Thomas Lumley tlumley at u.washington.edu
Wed Apr 18 01:43:00 CEST 2007

On Tue, 17 Apr 2007, Frank E Harrell Jr wrote:

> The points that Thomas and Brian have made are certainly correct, if one is 
> truly interested in testing for differences in medians or means.  But the 
> Wilcoxon test provides a valid test of x > y more generally.  The test is 
> consonant with the Hodges-Lehmann estimator: the median of all possible 
> differences between an X and a Y.

Yes, but there is no ordering of distributions (taken one at a time) that 
agrees with the Wilcoxon two-sample test, only orderings of pairs of 

The Wilcoxon test provides a test of x>y if it is known a priori that the 
two distributions are stochastically ordered, but not under weaker 
assumptions.  Otherwise you can get x>y>z>x. This is in contrast to the 
t-test, which orders distributions (by their mean) whether or not they are 
stochastically ordered.

Now, it is not unreasonable to say that the problems are unlikely to occur 
very often and aren't worth worrying too much about. It does imply that it 
cannot possibly be true that there is any summary of a single distribution 
that the Wilcoxon test tests for (and the same is true for other 
two-sample rank tests, eg the logrank test).

I know Frank knows this, because I gave a talk on it at Vanderbilt, but 
most people don't know it. (I thought for a long time that the Wilcoxon 
rank-sum test was a test for the median pairwise mean, which is actually 
the R-estimator corresponding to the *one*-sample Wilcoxon test).


More information about the R-help mailing list