[R] wilcox.test p-value = 0

Thomas Lumley tlumley at u.washington.edu
Wed Sep 16 04:33:12 CEST 2009


On Tue, 15 Sep 2009, Keo Ormsby wrote:

> Hi Murat,
> I am not an expert in either statistics nor R, but I can imagine that since the 
> default is exact=TRUE, It numerically computes the probability, and it may 
> indeed be 0. if you use wilcox.test(x, y, exact=FALSE) it will give you a 
> normal aproximation, which will most likely be different from zero.

No, the exact p-value can't be zero for a discrete distribution. The smallest possible value in this case would, I think, be 1/choose(length(x)+length(y),length(x)), or perhaps twice that.

More generally, the approach used by format.pvalue() is to display very small p-values as <2e-16, where 2e-16 is machine epsilon.  I wouldn't want to claim optimality for this choice, but it seems a reasonable way to represent "very small".

     -thomas


> Hope this helps.
> Keo.
>
> Murat Tasan escribió:
>> hi, folks,
>> 
>> how have you gone about reporting a p-value from a test when the
>> returned value from a test (in this case a rank-sum test) is
>> numerically equal to 0 according to the machine?
>> 
>> the next lowest value greater than zero that is distinct from zero on
>> the machine is likely algorithm-dependent (the algorithm of the test
>> itself), but without knowing the explicit steps of the algorithm
>> implementation, it is difficult to provide any non-zero value.  i
>> initially thought to look at .Machine at double.xmin, but i'm not
>> comfortable with reporting p < .Machine at double.xmin, since without
>> knowing the specifics of the implementation, this may not be true!
>> 
>> to be clear, if i have data x, and i run the following line, the
>> returned value is TRUE.
>> 
>> wilcox.test(x)$p.value == 0
>> 
>> thanks for any help on this!
>> 
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle




More information about the R-help mailing list