Skip to content
Prev 285562 / 398502 Next

Wilcoxon test p value with one decimal place

On 16-Feb-2012 Bert Gunter wrote:
To expand on Bert's reply:

Given two sets of 3 numbers (x,y,z), (X,Y,Z) with x < y < z
and X < Y < Z, there are exactly 20 ways to merge them together
(according to possible relationships between the values in the
first and the second):

  x < y < z < X < Y < Z
  x < y < X < z < Y < Z
  x < y < X < Y < z < Z
  x < y < X < Y < Z < z
  [and so on until]
  X < Y < x < Z < y < z
  X < Y < Z < x < y < z

Your example  is the first of these so has probability 1/20.
Since the default for wilcox.test is "two.sided", the result
takes into account also arrangements which are at least as
extreme as the one given, of which the only case is the last
one in the above list, which also has probability 1/20.

Hence the 2-sided P-value is 1/20 + 1/20 = 1/10, which is
exactly 0.1, as returned by wilcox.test(). It would be possible
to display the result as 0.10000, say, but there is no point!

If you do

  wilcox.test(a,b, alternative="less")

then you will get 0.05 as P-value -- again exactly right.

Ted.

-------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at wlandres.net>
Date: 16-Feb-2012  Time: 18:57:08
This message was sent by XFMail