Skip to content
Prev 10567 / 63424 Next

dwilcox (PR#4212)

not really:

R> dwilcox(.025, 3, 5)
[1] 0

which is natural since the statistic can take integer values only.
I think you failed to notice what `?qwilcox' tries to tell you:

     This distribution is obtained as follows.  Let 'x' and 'y' be two
     random, independent samples of size 'm' and 'n'. Then the Wilcoxon
     rank sum statistic is the number of all pairs '(x[i], y[j])' for
     which 'y[j]' is not greater than 'x[i]'.  This statistic takes
     values between '0' and 'm * n', and its mean and variance are 'm *
     n / 2' and 'm * n * (m + n + 1) / 12', respectively.

Moreover, it is documented that `probabilities are P[X <= x]' and
therefore

R> qwilcox(.025, 3, 5) + 3*4/2
[1] 7

means "the smallest x with P(W <= x) => 0.025 is 7" which you can check
easily

R> pwilcox(7 - 3*4/2, 3, 5)
[1] 0.03571429

whereas following your calculations

R> pwilcox(6 - 3*4/2, 3, 5)
[1] 0.01785714

Best,

Torsten