Rank-based comparisons
Rank-based tests compare two independent groups, paired observations, or three or more conditions or groups through the order of their observations rather than their values. The right test depends on how the observations are related, and what a report can claim from it depends on what the test assumes and what its rejection shows.
When a rank test fits
Tests based on ranking the data serve small datasets whose values are not normally distributed, and are similar to Student's t test for unpaired and paired data. Rank-order methods suit samples too small for conclusions about the probability distribution and data that are themselves ranks, and they may also suit small samples whose distribution is not normal and cannot be transformed to normal. Rank-order tests are not sensitive to asymmetry, or skew, in the population distributions, and they make more liberal assumptions about the underlying distributions.
Two independent groups
The Wilcoxon rank-sum test, also termed the Mann–Whitney U test, compares two independent groups through the ranks of their values in the combined sample, and it can be used when it is not known whether the distributions are symmetric. The values of both groups are ranked together, not within each group, with tied values taking the average of their ranks, and the ranks are then summed within each group. If the two populations were similar, the two rank sums would be expected to differ minimally. The U statistic is computed from the sizes of the two samples and the sum of the ranks in one of them.
The 2015 textbook calls the test the equivalent of the t test for parametric data, using the u distribution where the t test uses the distribution of t. The 2019 manual says it may be considered a nonparametric analogue of the two-sample t test.
The 2019 manual introduces the rank-sum test with two questions: whether the median difference between pairs of data in two populations equals 0, and whether two distributions share a single median. Both of its examples rank two independent groups. The 2015 textbook states the null hypothesis of the Mann–Whitney U test as a probability of 0.5 that a value in one group exceeds a value in the other. It sets the test apart from the signed-rank test, which ranks the differences within pairs where the Mann–Whitney U test ranks the whole dataset.
In the 2019 manual's first example, Lp(a) levels in 13 controls and 14 cases are ranked together. The rank sums, 95 for the controls and 283 for the cases, lie beyond the critical values of 116 for the smaller group and 248 for the larger at a two-tailed α of 0.001, so the null hypothesis is rejected at p < 0.001. In its second, 14 obese patients are randomised to a gastric band or a gastrectomy sleeve, 7 in each group, and their body mass index 6 months after surgery is distributed asymmetrically. The rank sums are 53.5 and 51.5, and a U of 23 to 24 for two groups of 7 corresponds to a two-tailed p value between 0.902 and 1.00, so the null hypothesis is not rejected.
The 2015 textbook determines u by listing the values of both groups in sequence and counting, below each value of one group, the values of the other group to its left. With four values in each group there are 70 possible orderings, and each extreme ordering, with every value of one group below every value of the other, has a probability of 1/70, or 0.014. Tables of the u distribution for various sample sizes are readily available. The textbook's example compares the ages of four Olympic gold medallists in gymnastics and four in the 1500 m. The gymnasts' positions give u = 5 and the runners' positions u = 11, either of which serves, and the textbook does not reject the null hypothesis.
Paired observations
The Wilcoxon signed-rank test is a paired-sample test. The 2015 textbook calls it distribution independent and so usable instead of the paired t test. The 2019 manual suggests that the test can be considered an extension of the paired t test to asymmetrically distributed, ordered categorical data that are ranked. The data need to be interval or ordinal, derived from the same sample, and paired, with each pair selected independently and at random. The 2015 textbook states its null hypothesis as a median difference of zero between the two samples. The 2019 manual presents the test as asking whether the median of the differences between paired data in a population of asymmetrically distributed data equals 0.
The test ranks the magnitude of the difference within each pair, ignoring its sign, and sums the ranks of the positive and of the negative differences separately. The further apart the two sums, the less likely the difference is due to chance. Pairs whose difference is zero are excluded before ranking. The smaller of the two sums is the statistic, which the 2019 manual calls W and the 2015 textbook t, and the lower W, the lower the P value.
The 2019 manual's table of critical values is entered at N, the number of nonzero differences, with columns for one-tailed and two-tailed P values. Its example is a crossover trial in 16 patients with a history of coronary heart disease that compares LDL cholesterol under a PCSK9 inhibitor and under usual care. The table is entered at N = 14, the pairs that differ, where W = 6 lies below the critical value for a two-tailed α of 0.010. The manual therefore rejects the null hypothesis at p < 0.010 and concludes that the median of the paired differences is not 0.
The 2015 textbook's example takes six pairs of pain scores 2 h after placebo and after an analgesic in a crossover study of tension headache. The positive differences have a rank sum of 17 and the negative differences a rank sum of 4, so t = 4. At six pairs, the textbook's table gives 1 as the critical value of t at p = 0.05, and the 2019 manual's table gives 2 for a one-tailed and 1 for a two-tailed P value of 0.05.
Three or more conditions in the same patients
The Friedman test, developed by the Nobel laureate economist Milton Friedman, evaluates differences in paired ranked data, as when each of n patients rates their satisfaction with k treatments or each patient receives three or more treatments by block randomisation. The conditions are ranked within each patient, so with three treatments every rank is 1, 2 or 3. The statistic is computed from the number of patients, the number of treatments and the rank sum of each treatment.
The 2019 manual says the test can tell which treatment ranked higher or lower as well as whether patients' ratings are consistent. Its example ranks cord blood antibody levels in 10 pregnant women under placebo and two doses of an anthelmintic, with rank sums of 27, 20 and 13. The statistic of 9.8 is consistent with p < 0.01 on the χ² distribution with 2 degrees of freedom, and from that overall result the manual accepts that placebo differs from either of the two doses.
Three or more independent groups
The Kruskal–Wallis test, also termed the one-way ANOVA on ranks, can in some ways be read as the rank-sum test extended to three or more groups and as a nonparametric analogue of the one-way analysis of variance. It can be used to assess differences between two or more arms of an independent variable for a dependent variable that is ordinal or continuous, and it may be useful when the assumptions of one-way ANOVA are not met. The values of all groups are ranked together and the ranks summed within each group. In the 2019 manual's example, the asymmetrically distributed pulse pressures of 21 patients with three forms of largely subclinical target-organ damage give rank totals of 78, 100 and 53. The statistic, H, exceeds 5.99, the critical value of χ² at p = 0.05 for k − 1 = 2 degrees of freedom, so the null hypothesis is rejected at p < 0.05.