# p value of 1 for Mann-Whitney U - artifact of R?

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

• 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. – Sycorax May 20 at 18:07
• @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 – myfatson May 20 at 18:11
• you should ask those people for more deatils. – Sycorax May 20 at 18:13
• @SycoraxsaysReinstateMonica, the rest of the discussion is cross-linked in my post. – myfatson May 20 at 18:56
• Does this answer your question? What does a p-value of exactly 1.0000 mean? – Sycorax May 20 at 19:05

$$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.)