University of Minnesota, Twin Cities     School of Statistics     Stat 5601     Rweb     Computing Examples

Stat 5601 (Geyer) Examples (Wilcoxon Rank Sum Test and Related Procedures)

Contents

General Instructions

To do each example, just click the "Submit" button. You do not have to type in any R instructions or specify a dataset. That's already done for you.

The Wilcoxon Rank Sum Test

Example 4.1 in Hollander and Wolfe.

External Data Entry

Enter a dataset URL :

Summary

Comments

The Associated Point Estimate (Median of the Pairwise Differences)

The Hodges-Lehmann estimator associated with the rank sum test is the median of the pairwise differences, which are the nx ny differences

Yj - Xi,     for all i and j

Example 4.3 in Hollander and Wolfe.

External Data Entry

Enter a dataset URL :

Summary

The Associated Confidence Interval

Very similar to the confidence intervals associated with the sign test and signed rank test, the confidence interval has the form

(D(k), D(m + 1 - k))
where m = nx ny is the number of pairwise differences, the Di are the pairwise differences, and, as always, parentheses on subscripts indicates order statistics. That is, one counts in k from each end in the list of sorted pairwise differences to find the confidence interval.

Example 4.4 in Hollander and Wolfe.

External Data Entry

Enter a dataset URL :

Summary

Comments

The R Function wilcox.test

All of the above can be done in one shot with the R function wilcox.test (on-line help).

External Data Entry

Enter a dataset URL :

Only one complaint. It does not report the actual achieved confidence level (here 96.0%) but rather the confidence level asked for (here 95%, the default). If you want to know the actual achieved confidence level, you'll have to use the code in the confidence interval section above. But you can use wilcox.test as a convenient check (the intervals should agree).

Warning About Ties and Zeros

Do not use the wilcox.test function when there are ties or zeros in the data. See the following section.

The R Function wilcox.exact

There is an R function wilcox.exact (on-line help) that does do hypothesis tests correctly in the presence of ties.

It does not do confidence intervals or point estimates correctly in the presence of ties. Use the code in the confidence interval section or the point estimate section above.

External Data Entry

Enter a dataset URL :

In order to see what's going on, let's copy some of the code from the beginning of the calculation without the function. This shows the ranks so we see the tied ranks and shows the calculation of the test statistic u so we can see that it agrees with the test statistic calculated by wilcox.exact.

External Data Entry

Enter a dataset URL :