[R] Mann-Whitney & Wilcoxon Rank Sum

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon May 16 08:34:27 CEST 2005


Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

> as essentially
> 
>  	r <- rank(c(x,y))
>  	sum(r[seq(along = x)]) - n.x * (n.x + 1)/2
> 
> I guess your reference just uses the first term.
> 
> Another way of looking at this is whether ranks start at 0 or at 1 (as
> in rank()): R's definition is the rank sum with 0-based ranks.

Er, no... Then you'd be subtracting n.x. The definition is such that
the minimum value of the statistic becomes zero (2nd term is equal to
sum(1:n.x)).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list