0
$\begingroup$

Cross posted from stack: https://stackoverflow.com/questions/61916001/p-value-of-1-for-mann-whitney-u-artifact-of-r/61916714#61916714

I'm using the rstatix library in R 3.6.3 through RStudio 1.2.5042 and am getting the impossible p-value of 1 when running a two-sample Wilcoxon aka Mann-Whitney U Test.

My first instinct says this is a floating point precision issue and the actual value is something like 0.999999 but I came here to confirm before an undisclosed federal research agency gets up my ass about it.

Here's my code:

wilcox_test(data, DV ~ Group, paired = F, exact = T, alternative = "two.sided", conf.level = 0.95, detailed = T)

.csv formatted data:

DV,Group,Subject
4,Treatment,1
5,Control,2
2,Treatment,4
0,Control,6
0,Control,7
3,Control,8
0,Control,9
1,Control,10
0,Treatment,12
3,Control,13
4,Control,14
0,Control,15
3,Control,18
2,Treatment,19
2,Control,21
NA,Treatment,22
1,Control,23
3,Treatment,24
4,Control,25
5,Treatment,26
1,Treatment,27
4,Control,28
1,Control,29
5,Treatment,31
2,Control,32
2,Treatment,34
3,Treatment,35
2,Treatment,36
4,Control,37
1,Treatment,38
1,Treatment,39
4,Control,40
NA,Treatment,41
3,Treatment,42
0,Control,43
NA,Treatment,44
1,Treatment,46
3,Control,47
2,Treatment,48
2,Treatment,49
1,Treatment,50
2,Treatment,52
2,Control,53
2,Control,54
$\endgroup$
  • 1
    $\begingroup$ printing all digits of wilcox_test(data, DV ~ Group, paired = F, exact = T, alternative = "two.sided", conf.level = 0.95, detailed = T)$p.value will give you the answer. IEEE 754 explains how floating point arithmetic works. $\endgroup$ – Sycorax May 20 at 18:07
  • $\begingroup$ @SycoraxsaysReinstateMonica thanks! It printed out p=1 still, others have suggested that this could be due to ties in the data in addition to some missing data. I used KNN imputation to fill in those missing values and got a more reasonable result. Statistic = 247.5, p = 0.905 $\endgroup$ – myfatson May 20 at 18:11
  • $\begingroup$ you should ask those people for more deatils. $\endgroup$ – Sycorax May 20 at 18:13
  • $\begingroup$ @SycoraxsaysReinstateMonica, the rest of the discussion is cross-linked in my post. $\endgroup$ – myfatson May 20 at 18:56
  • 1
    $\begingroup$ Does this answer your question? What does a p-value of exactly 1.0000 mean? $\endgroup$ – Sycorax May 20 at 19:05
4
$\begingroup$

$p=1$ precisely is not impossible. Possible values of the Wilcoxon statistic are discrete, so it is possible (if unlikely, but not less so than $p=0.99999$ in standard continuous testing) that the statistic takes the value most compatible with the null hypothesis precisely, leading to $p=1$. (I haven't checked against your data whether this is indeed the case here, but it certainly may.)

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.