Skip to content

Commit 24688cd

Browse files
author
hornik
committed
Document improvements to wilcox.test().
git-svn-id: https://svn.r-project.org/R/trunk@88758 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent f1bb3ba commit 24688cd

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

doc/NEWS.Rd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@
8888

8989
\item \code{chkDots()}' optional argument \code{allowed} has been
9090
implemented thanks to \I{Trevor Davis}' proposal in \PR{18936}.
91+
92+
\item \code{wilcox.test()} can now perform exact (conditional)
93+
inference in case of ties. Based on contributions by
94+
\I{Torstehn Hothorn}.
95+
96+
\item \code{wilcox.test()} can now optionally compute improved
97+
asymptotic p-values by including up to 3 correction terms of the
98+
Edgeworth series for the normal approximation.
9199
}
92100
}
93101

src/library/stats/man/wilcox.test.Rd

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ wilcox.test(x, \dots)
3939
\item{exact}{a logical indicating whether an exact p-value
4040
should be computed.}
4141
\item{correct}{a logical indicating whether to apply continuity
42-
correction in the normal approximation for the p-value.}
42+
correction in the normal approximation for the p-value, or an
43+
integer \eqn{k} between 0 and 3 giving the number of correction
44+
terms to use from the Edgeworth series for the normal approximation.}
4345
\item{conf.int}{a logical indicating whether a confidence interval
4446
should be computed.}
4547
\item{conf.level}{confidence level of the interval.}
@@ -85,8 +87,19 @@ wilcox.test(x, \dots)
8587
of \code{y}).
8688

8789
By default (if \code{exact} is not specified), an exact p-value
88-
is computed if the samples contain less than 50 finite values and
89-
there are no ties. Otherwise, a normal approximation is used.
90+
is computed if the samples contain less than 50 finite values.
91+
Otherwise, a normal approximation is used. If there are ties, exact
92+
inference is performed using the conditional/permutation distribution
93+
given the observed ranks, using an implementation of the
94+
Streitberg-Röhmel shift algorithm
95+
\bibcitep{R:Streitberg+Roehmel:1986, R:Streitberg+Roehmel:1987}
96+
contributed by \I{Torsten Hothorn}.
97+
98+
If the normal approximation is used and there are no ties, improved
99+
asymptotic p-values can be obtained via including up to \eqn{k = 3}
100+
correction terms of the Edgeworth series for the normal approximation,
101+
as given in \bibcitet{R:Fellingham+Stoker:1964} for the signed rank
102+
test and in \bibcitet{R:Fix+Hodges_Jr_:1955} for the rank sum test.
90103

91104
For stability reasons, it may be advisable to use rounded data or to set
92105
\code{digits.rank = 7}, say, such that determination of ties does not
@@ -219,8 +232,8 @@ wilcox.test(Ozone ~ Month, data = airquality,
219232
subset = Month \%in\% c(5, 8))
220233

221234
## accuracy in ties determination via 'digits.rank':
222-
wilcox.test( 4:2, 3:1, paired=TRUE) # Warning: cannot compute exact p-value with ties
223-
wilcox.test((4:2)/10, (3:1)/10, paired=TRUE) # no ties => *no* warning
235+
wilcox.test( 4:2, 3:1, paired=TRUE)
236+
wilcox.test((4:2)/10, (3:1)/10, paired=TRUE)
224237
wilcox.test((4:2)/10, (3:1)/10, paired=TRUE, digits.rank = 9) # same ties as (4:2, 3:1)
225238
}
226239
\keyword{htest}

0 commit comments

Comments
 (0)