Content
Summary
The Wilcoxon Rank-Sum Test is a nonparametric alternative to the independent-samples t-test used when data is not normally distributed or is ordinal. It operates by ranking all observations from two independent groups and comparing the sum of ranks to determine if one distribution is shifted relative to the other. The test relies on a normal approximation for samples where both group sizes are at least 10.
Intuition
Imagine you have two groups of patients, such as those with different genetic types of retinitis pigmentosa, and you want to compare their visual acuity. Since visual acuity might be ordinal or not normally distributed, you cannot simply average the scores. Instead, you combine all patients from both groups and rank them from best to worst vision. If the two groups are truly identical, the ranks should be evenly mixed between them. If one group consistently has higher ranks, it suggests that group has better visual acuity. The test statistic measures how far the observed sum of ranks deviates from what we would expect if the groups were identical, allowing us to assess statistical significance.
Key equations
Null hypothesis that cumulative distribution functions are equal; alternative that they differ by a location shift .
Expected rank sum for the first group under the null hypothesis.
Variance of the rank sum under the null hypothesis when there are no tied values.
Test statistic T when ties are present, where t_i is the number of observations in the i-th tied group and g is the number of tied groups.
Calculation of the two-sided p-value using the standard normal cumulative distribution function .
Derivation
- Combine the data from two independent samples of sizes n_1 and n_2.
- Rank all N = n_1 + n_2 observations from lowest to highest.
- Handle ties by assigning the average rank to each observation in a tied group.
- Calculate the rank sum R_1 for the first group.
- Determine the expected rank sum E(R_1) under the null hypothesis.
- Calculate the variance Var(R_1), applying a correction factor if ties are present.
- Compute the test statistic T using the normal approximation.
- Reject the null hypothesis if T exceeds the critical value .
Worked example
Compare visual acuity between two genetic types of retinitis pigmentosa. Group 1 has n_1=10 patients and Group 2 has n_2=10 patients. The sum of ranks for Group 1 is R_1=130. There are no ties. Is there a significant difference at
- Calculate expected rank sum: E(R_1) = 10(10+10+1)/2 = 105.
- Calculate variance: Var(R_1) = 10*10*(21)/12 = 175.
- Calculate standard deviation: .
- Calculate T: (130 - 105) / 13.23 ≈ 1.89.
- Compare T to z_{0.975} ≈ 1.96. Since 1.89 < 1.96, we do not reject H_0.
Answer T ≈ 1.89; Fail to reject H_0.
Common mistakes
- Using the test when sample sizes are less than 10, as the normal approximation may not be valid.
- Ignoring ties when calculating the variance, which leads to an incorrect test statistic.
- Confusing the Wilcoxon Rank-Sum Test (for independent samples) with the Wilcoxon Signed-Rank Test (for paired samples).
- Assuming the test requires the data to be normally distributed, which is contrary to its purpose.