[R] Wilcoxon Rank Sum Test
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Wed Mar 20 22:33:27 CET 2002
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list