Skip to content
Back to formatted view

Raw Message

Message-ID: <x2elie3owo.fsf@blueberry.kubism.ku.dk>
Date: 2002-03-20T21:33:27Z
From: Peter Dalgaard
Subject: Wilcoxon Rank Sum Test
In-Reply-To: <OF5C564BB1.341BD591-ON88256B82.006EB583@pe-c.com>

Ngayee.Law at celeradiagnostics.com writes:

> 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

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

            ....
        }
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._