[R] help comparing two median with R

Frank E Harrell Jr f.harrell at vanderbilt.edu
Wed Apr 18 14:02:14 CEST 2007


Thomas Lumley wrote:
> 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 distributions.
> 
> 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).
> 
> 
>     -thomas
> 

Thanks for your note Thomas.  I do feel that the problems you have 
rightly listed occur infrequently and that often I only care about two 
groups.  Rank tests generally are good at relatives, not absolutes.  We 
have an efficient test (Wilcoxon) for relative shift but for estimating 
an absolute one-sample quantity (e.g., median) the nonparametric 
estimator is not very efficient.  Ironically there is an exact 
nonparametric confidence interval for the median (unrelated to Wilcoxon) 
but none exists for the mean.

Cheers,
Frank
-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list