Premed · Premed · Statistics Biostatistics

Lecture 22: Nonparametric Methods

Statistics / Biostatistics


Learning Objectives

By the end of this lecture, students will be able to:

  1. Explain when nonparametric methods are preferred over parametric methods
  2. Perform and interpret the Wilcoxon signed-rank test (paired data)
  3. Perform and interpret the Mann-Whitney U test (two independent groups)
  4. Perform and interpret the Kruskal-Wallis test (three or more groups)
  5. Describe additional nonparametric methods and their applications

Lecture Content

I. Why Nonparametric Methods?

Parametric methods such as t-tests and ANOVA assume specific distributional forms, typically normality. Nonparametric methods, also called "distribution-free" methods, make fewer assumptions about the underlying distribution. They should be used when data are clearly non-normal and the sample size is too small for the Central Limit Theorem to help, when data are ordinal (such as Likert scales or pain ratings), when data contain extreme outliers that would unduly influence parametric tests, or when the outcome is a rank or the distribution has heavy tails. The trade-off is that nonparametric methods are generally less powerful than parametric methods when parametric assumptions are met, typically achieving about 90-95% of the efficiency.

II. The Sign Test

The sign test is the simplest nonparametric test for paired data. For each pair, the direction of the difference is recorded as positive (+), negative (-), or zero (a tie), with ties discarded. Under H0 (no systematic difference), the number of positive signs follows a Binomial(n, 0.5) distribution. The sign test is very simple but has low power compared to the Wilcoxon signed-rank test. It is most useful when only the direction of change is known but not the magnitude.

III. Wilcoxon Signed-Rank Test

The Wilcoxon signed-rank test is the nonparametric alternative to the paired t-test. The procedure begins by calculating the differences d_i = x_after - x_before for each pair. Next, the absolute values of the differences are ranked (discarding zeros), and each rank is assigned the sign of its corresponding difference. W+ (the sum of positive ranks) and W- (the sum of negative ranks) are then calculated, and the test statistic is the smaller of W+ and W- (or W+ alone, depending on the formulation).

The hypotheses test whether the distribution of differences is symmetric around zero. The assumptions are that the observations are paired, the differences are continuous (or at least ordinal), and the distribution of differences is symmetric. For large samples, the test statistic is approximately normal.

<image>A step-by-step worked example of the Wilcoxon signed-rank test. A table shows 8 paired observations (before, after), the differences, absolute differences, ranks, and signed ranks. Below the table, W+ and W- are calculated. The test statistic and critical value are compared, and a conclusion is stated. A small number line shows where each signed rank falls relative to zero.</image>

IV. Mann-Whitney U Test (Wilcoxon Rank-Sum Test)

The Mann-Whitney U test is the nonparametric alternative to the independent two-sample t-test. The procedure combines all observations from both groups and ranks them from smallest to largest. The ranks are then summed for each group separately (R_1 and R_2), and U_1 = n_1n_2 + n_1(n_1+1)/2 - R_1 is calculated (similarly for U_2). The test statistic is the smaller of U_1 and U_2.

The null hypothesis states that the two populations have the same distribution -- equivalently, that any observation from one group is equally likely to be greater or less than an observation from the other. The assumptions are independent groups, a continuous (or ordinal) outcome, and similar distributional shape (when testing medians specifically). For large samples, U is approximately normal: z = (U - n_1n_2/2) / sqrt(n_1n_2*(n_1+n_2+1)/12).

V. Kruskal-Wallis Test

The Kruskal-Wallis test is the nonparametric alternative to one-way ANOVA, comparing three or more independent groups. All observations across all groups are ranked together, and the sum of ranks for each group is calculated. The test statistic is H = [12 / (N(N+1))] * sum(R_j^2 / n_j) - 3(N+1), where R_j is the sum of ranks in group j, n_j is the size of group j, and N is the total sample size. Under H0, H approximately follows a chi-square distribution with df = k - 1.

The hypotheses are H0: all k populations have the same distribution versus H1: at least one differs. If the test is significant, follow-up pairwise comparisons can be performed using Dunn's test with a multiple comparison adjustment.

<image>A side-by-side comparison of parametric and nonparametric methods. Three rows: (1) Paired data: paired t-test vs. Wilcoxon signed-rank test. (2) Two independent groups: independent t-test vs. Mann-Whitney U test. (3) Three or more groups: one-way ANOVA vs. Kruskal-Wallis test. For each row, a brief description of assumptions and a small icon representing the data type (e.g., bell curve for parametric, skewed distribution for nonparametric). An arrow between each pair indicates when to switch from parametric to nonparametric.</image>

VI. Handling Ties

Ties (identical values) are common in practice, especially with ordinal or rounded data. The standard approach is to assign tied observations the average of the ranks they would have occupied. For example, two observations tied for ranks 3 and 4 each receive rank 3.5. Most nonparametric tests include a correction factor for ties. When ties are extensive, exact permutation tests, available in modern software, may be preferable.

VII. Friedman Test

The Friedman test is the nonparametric alternative to repeated measures ANOVA, used when the same subjects are measured under three or more conditions. Ranks are assigned within each subject (block) across conditions. The test statistic follows a chi-square distribution with df = k - 1 under H0. Post-hoc comparisons can be performed using the Nemenyi test or pairwise Wilcoxon signed-rank tests with Bonferroni correction.

VIII. Nonparametric Correlation (Review)

Spearman's rho and Kendall's tau, covered in Lecture 19, are both rank-based correlation measures. They are appropriate when data are ordinal, the relationship is monotonic but not necessarily linear, or the assumptions for Pearson's r are violated.

IX. Advantages and Limitations

Nonparametric methods offer several advantages: they require fewer assumptions about the distribution, are robust to outliers, can be used with ordinal data, and are valid for small sample sizes. However, they also have limitations: they are less powerful than parametric tests when parametric assumptions hold, they test the entire distribution rather than just the mean (which can complicate interpretation), they are harder to extend to complex models involving multivariable adjustment, and confidence intervals and effect sizes are less straightforward to compute.

The modern recommendation is to use parametric methods when assumptions are reasonably met, as they are often more robust than commonly believed. Nonparametric methods should be reserved for situations where assumptions are clearly violated.

<image>A power comparison simulation. The x-axis shows sample size (n = 10 to 100). The y-axis shows power (0 to 1). Two lines are plotted for each of three scenarios. Scenario 1 (normal data): the t-test line is slightly above the Mann-Whitney line (parametric is more powerful). Scenario 2 (mildly skewed data): the lines are nearly identical. Scenario 3 (heavily skewed data with outliers): the Mann-Whitney line is substantially above the t-test line. A horizontal dashed line at power = 0.80 is shown. The figure demonstrates that nonparametric methods outperform parametric methods when assumptions are violated.</image>


Lecture 22: Nonparametric Methods — figure 1
Lecture 22: Nonparametric Methods — figure 2
Lecture 22: Nonparametric Methods — figure 3

Read this lecture as Markdown