Chapter 6 Statistical Inference 265
Applying a Nonparametric Test to
Two-Sample Data
The two-sample nonparametric test is the Mann-Whitney test. In the Mann-
Whitney test we rank all of the values from smallest to largest and then sum
the ranks in each sample. Unlike the Wilcoxon test, we do not rank the abso-
lute data values or multiply the ranks by the sign of the original data. Table 6-7
shows an example of two sample data along with the calculated ranks.
Table 6-7 Two-Sample data
Sample 1 Values Ranks Sample 2 Values Ranks
22 12.0 23 3.0
16 11.0 21 4.0
1 5.0 2 6.0
24 1.5 8 9.0
7 8.0 24 1.5
3 7.0
9 10.0
Note that we don’t need to have equal sample sizes. Our null hypothesis
is that both samples have the same median value. In this example, the sum
of the Sample 1 ranks is 54.5, and the sum of the Sample 2 ranks is 23.5. We
can use probability theory to determine the probability of the fi rst sample
having a rank sum of 54.5 or greater if the null hypothesis were true. In this
case, that p value would be 0.176, which would not support rejecting the
null hypothesis.
When using the Mann-Whitney test, we also need to calculate the median
difference between the two samples. This is done by calculating the differ-
ence for each pair of observations taken from Sample 1 and Sample 2 and
then determining the median of those differences. For the data in Table 6-6,
there are 35 pairs, starting with the difference between 22 and 2 3 (the fi rst
observations in the samples) and going down to the difference between 9
and 2 4 (the last observations). The median of these 35 differences is 7. By
comparison, the difference of the sample averages is 7.31, so the median dif-
ference is pretty close. When the sample sizes get large, these calculations
cannot be easily done by hand.
The Mann-Whitney test makes only four assumptions.
- Both samples are random samples taken from their respective probability
distributions. - The samples are independent of each other.
- The measurement scale is at least ordinal.
- The two distributions have the same shape.