[R] about a p-value < 2.2e-16

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Fri Mar 19 17:34:34 CET 2021


For me, it was always clear based on the documentation that if there are ties, then the normal approximation is used (irrespective of what 'exact' is set to). In fact, if there are ties, the output even tells you that this is happening:

wilcox.test(c(1,3,2,2,4), exact=TRUE)

[...]
Warning message:
In wilcox.test.default(c(1, 3, 2, 2, 4), exact = TRUE) :
  cannot compute exact p-value with ties

Best,
Wolfgang

>-----Original Message-----
>From: Jiefei Wang [mailto:szwjf08 using gmail.com]
>Sent: Friday, 19 March, 2021 16:32
>To: Viechtbauer, Wolfgang (SP)
>Cc: r-help
>Subject: Re: [R] about a p-value < 2.2e-16
>
>Dear Wolfgang,
>
>Thanks for the documentation, but the document only states the default behavior,
>it does not mention what would happen if we tell it to compute the exact p-value
>but the data has ties. I think this would be misleading as people might think
>their result is exact by specifying `exact=TRUE` but the truth is that their data
>contains ties and the result is from the normal approximation.
>
>Best,
>Jiefei
>
>On Fri, Mar 19, 2021 at 11:18 PM Viechtbauer, Wolfgang (SP)
><wolfgang.viechtbauer using maastrichtuniversity.nl> wrote:
>Dear Jiefei,
>
>This behavior is documented. From help(wilcox.test):
>
>"By default (if exact is not specified), an exact p-value is computed if the
>samples contain less than 50 finite values and there are no ties. Otherwise, a
>normal approximation is used."
>
>Best,
>Wolfgang
>
>>-----Original Message-----
>>From: R-help [mailto:r-help-bounces using r-project.org] On Behalf Of Jiefei Wang
>>Sent: Friday, 19 March, 2021 15:52
>>To: Spencer Graves
>>Cc: r-help; Bogdan Tanasa
>>Subject: Re: [R] about a p-value < 2.2e-16
>>
>>After digging into the R source, it turns out that the argument `exact` has
>>nothing to do with the numeric precision. It only affects the statistic
>>model used to compute the p-value. When `exact=TRUE` the true distribution
>>of the statistic will be used. Otherwise, a normal approximation will be
>>used.
>>
>>I think the documentation needs to be improved here, you can compute the
>>exact p-value *only* when you do not have any ties in your data. If you
>>have ties in your data you will get the p-value from the normal
>>approximation no matter what value you put in `exact`. This behavior should
>>be documented or a warning should be given when `exact=TRUE` and ties
>>present.
>>
>>FYI, if the exact p-value is required, `pwilcox` function will be used to
>>compute the p-value. There are no details on how it computes the pvalue but
>>its C code seems to compute the probability table, so I assume it computes
>>the exact p-value from the true distribution of the statistic, not a
>>permutation or MC p-value.
>>
>>Best,
>>Jiefei


More information about the R-help mailing list