[R] wilcox.test; data type conversion?
Peter Dalgaard
pdalgd at gmail.com
Sat Oct 30 17:04:06 CEST 2010
On 10/29/2010 06:24 AM, Steven McKinney wrote:
>> > wilcox.test(as.integer(grade) ~ sex, data = gradesbysex)
> Wilcoxon rank sum test with continuity correction
>
> data: as.integer(grade) by sex
> W = 4.5, p-value = 0.2695
> alternative hypothesis: true location shift is not equal to 0
>
> Warning message:
> In wilcox.test.default(x = c(3L, 2L, 1L, 1L, 1L, 2L), y = c(2L, :
> cannot compute exact p-value with ties
>
> You can break the ties by jittering the data. Each jitter will of course
> produce different tie breakers. A few repeats of the test, or a loop and
> some summaries of the outcomes, will give you an idea of the
> "average" result.
I wouldn't bother with that. The p-value is based on the correct
covariance matrix of the rank sums, tie-breaking just adds noise to the
analysis. If you really want an exact p-value, package exactRankTests is
the ticket. (Or, if there is really only 3 females in 9 students, you
can get ambitious and set up the permutation distribution by enumerating
the choose(9,3)=84 possible outcomes.)
--
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list