Skip to content

Wilcoxon Rank Sum Test

2 messages · Ngayee.Law@celeradiagnostics.com, Peter Dalgaard

#
How does R compute the p-value in the Wilcoxon Rank Sum Test?
If I have the test statistics, can I get the p-value using the function
pwilcox?
Thanks

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Ngayee.Law at celeradiagnostics.com writes:
Yes, but only if there are no ties in the data.

You can just print wilcox.test.default and see the following code:

        if (exact && !TIES) {
            PVAL <- switch(alternative, two.sided = {
                p <- if (STATISTIC > (n.x * n.y/2)) 
                  pwilcox(STATISTIC - 1, n.x, n.y, lower = FALSE)
                else pwilcox(STATISTIC, n.x, n.y)
                min(2 * p, 1)
            }, greater = {
                pwilcox(STATISTIC - 1, n.x, n.y, lower = FALSE)
            }, less = pwilcox(STATISTIC, n.x, n.y))

            ....
        }