# Does it make sense to run Wilcoxon rank sum test with sample size of 1 or 2?

suppose I have the following numbers.

y <- c(0.378, 0.347, 0.398, 2.05, .06, .29, 1.06, .14, 1.29)

x2 <- c(.1)
wilcox.test(y,x2)

x3 <- c(.1, .2,)
wilcox.test(y,x3)


I'm surprised that the first example with a sample of 1 yielded a p value. Does this p value mean anything? What about when its N=2?

thanks!

• It depends on what you mean by 'mean anything'. As shown in my Answer, it is not possible to get a significant P-value if the first sample has nine observations and second sample has only one observation. For your particular choice of x3 the P-value is not significant. However, in this case, it is possible for a second sample of size two to yield a significant result. Commented Oct 14, 2020 at 0:13

Repeating your R session---with a correction and some modifications.

 y <- c(0.378, 0.347, 0.398, 2.05, .06, .29, 1.06, .14, 1.29)
x2 <- c(.1)
wilcox.test(y,x2)

Wilcoxon rank sum test

data:  y and x2
W = 8, p-value = 0.4
alternative hypothesis: true location shift is not equal to 0


The P-value is $$0.4 > 0.05,$$ so there is no significant difference in location at the 5% level. However, with only one observation in x1 you will not get a significant result even if the value in x2 is greater than any value in y.

xx2 = c(3)
wilcox.test(y,xx2)

Wilcoxon rank sum test

data:  y and xx2
W = 0, p-value = 0.2
alternative hypothesis: true location shift is not equal to 0


By chance alone, there are two chances in ten that the one value in xx2 might have been the largest or the smallest of all the observations.

x3 <- c(.1, .2)     \$ note: extra comma deleted
wilcox.test(y,x3)

Wilcoxon rank sum test

data:  y and x3
W = 15, p-value = 0.2182
alternative hypothesis:
true location shift is not equal to 0


Again here, a non-significant P-value is computed.

The change here is that--if both values in xx3 are extreme--then it is possible for the P-value to be significant at the 5% level.

xx3 = c(3,4)
wilcox.test(y,xx3)

Wilcoxon rank sum test

data:  y and xx3
W = 0, p-value = 0.03636
alternative hypothesis:
true location shift is not equal to 0


By chance alone, there are 2 chances in $${11\choose 2}= 55$$ that the two observations in xx3 would be the two largest or the two smallest out of $$9+2=11,$$ then $$2/55 = 0.03636.$$