13 Non-parametric Alternatives
By the end of this chapter you will be able to:
- Decide when a non-parametric test is the right call.
- Run and interpret the rank-based tests: Mann-Whitney/Wilcoxon, Kruskal-Wallis, and Friedman.
- Use Spearman correlation for ranked or non-linear (but monotonic) relationships.
- Report non-parametric results in APA style — including the W (R output) vs. U (APA convention) distinction.
Non-parametric tests are the fallback for when normality is violated, when your data are ordinal rather than continuous, or when you just don’t want to assume a particular distribution. They work on ranks of the data rather than the raw values, which makes them robust to outliers and to non-normal distributions.

This chapter covers the five tests you’ll use most often:
- Wilcoxon rank-sum (Mann-Whitney U) — two independent groups
- Wilcoxon signed-rank — paired data or one sample
- Kruskal-Wallis — three or more independent groups
- Friedman — repeated measures
- Spearman’s rank correlation — monotonic association
13.1 When to reach for a non-parametric test
Non-parametric tests are appropriate when:
- Your data don’t meet normality assumptions (heavily skewed, has outliers, or stays non-normal after transformation).
- You have small sample sizes where the Central Limit Theorem can’t rescue you.
- Your variables are ordinal or rank-based to begin with.
- You simply prefer rank-based tests over parametric methods.
The cost: a different style of interpretation (you’re comparing distributions or medians, not exact means), and some loss of statistical power when the data really are close to normal — rank-based tests throw away information about exact magnitudes. With strongly skewed or heavy-tailed data, rank-based tests can actually be more powerful than their parametric counterparts.
13.2 Two-sample tests
13.2.1 Wilcoxon rank-sum (Mann-Whitney U) — two independent groups
Use when: You want to compare two independent groups, and the parametric t-test isn’t appropriate.
Hypotheses:
- \(H_0\): The two populations have the same distribution.
- \(H_1\): The distributions differ.
Read a significant result as a difference in distributions, not specifically in medians. The median reading is only justified if you are willing to assume the two distributions have the same shape and differ only in location — worth checking on your boxplot before you write it up.
Data setup: A numeric outcome and a grouping factor with two levels.
# Example data
df <- data.frame(
score = c(5.1, 6.3, 4.8, 9.2, 7.0, 6.4, 7.7, 3.5, 8.1, 6.2),
group = rep(c("Control", "Treatment"), each = 5)
)
# Wilcoxon rank-sum (Mann-Whitney) test
wilcox.test(score ~ group, data = df, exact = FALSE)
# Course effect-size convention: Rosenthal's r
library(rstatix)
wilcox_effsize(df, score ~ group)exact = FALSE tells R to use the asymptotic approximation rather than computing the exact p-value. The exact method can be slow with larger samples or when there are tied ranks.
Interpretation:
- R’s
wilcox.test()reports the statistic as W; for the two-sample test this is the Mann-Whitney U for the first group, which is the label APA write-ups use. The number is the same — only the name differs — so report R’s value but call it U in your write-up. (Strictly, a two-group comparison has two U values with \(U_1 + U_2 = n_1 n_2\); report the one your software produces.) - \(p < 0.05\) → reject \(H_0\) → the distributions appear to differ.
- The test does not directly estimate the size of the difference. Report group medians and Rosenthal’s \(r\) from
rstatix::wilcox_effsize()regardless of significance. Some software instead reports the rank-biserial correlation; that is a legitimate but different statistic, so name it explicitly and do not expect the two values to match.
13.2.2 Wilcoxon signed-rank — paired data
Use when: You have paired or repeated measurements on the same subjects (pre/post designs, matched pairs), or one sample compared to a hypothesized median.
Assumes: the differences (paired data) or the values (one sample) are roughly symmetric around their center. When that holds, the test is about the median. A few outliers in otherwise balanced data are fine; data that lean heavily to one side overall, like incomes, are not, and then the result is not a clean test of the median.
Hypotheses:
- \(H_0\): The median difference (post − pre) is 0.
- \(H_1\): The median difference is not 0.
R syntax for paired data:
df <- data.frame(
pre = c(5.2, 4.9, 6.1, 7.0, 5.8),
post = c(6.3, 5.0, 6.5, 8.0, 6.1)
)
wilcox.test(df$post, df$pre, paired = TRUE, exact = FALSE)
# Put the paired scores in long form for the course effect size
df_long <- tidyr::pivot_longer(
df,
cols = c(pre, post),
names_to = "time",
values_to = "score"
)
rstatix::wilcox_effsize(df_long, score ~ time, paired = TRUE)For a one-sample test against a hypothesized median:
one_sample <- data.frame(
score = c(5.2, 4.9, 6.1, 7.0, 5.8)
)
wilcox.test(one_sample$score, mu = 5, exact = FALSE)
rstatix::wilcox_effsize(one_sample, score ~ 1, mu = 5)Interpretation:
- A significant result suggests the typical (median) difference is not zero.
- Report the median difference alongside the test result.
- Report Rosenthal’s \(r\) from
rstatix::wilcox_effsize(..., paired = TRUE)regardless of significance.
13.3 Comparing more than two groups
13.3.1 Kruskal-Wallis test
Use when: You want to compare three or more independent groups on a numeric or ordinal outcome — the non-parametric equivalent of one-way ANOVA.
Hypotheses:
- \(H_0\): All groups have the same distribution.
- \(H_1\): At least one group differs.
R syntax:
df <- data.frame(
score = c(5.1, 6.3, 4.8, 7.2, 9.0, 7.5, 5.9, 6.1, 8.2),
group = c("Low", "Low", "Low",
"Medium", "Medium", "Medium",
"High", "High", "High")
)
kruskal.test(score ~ group, data = df)
# Course effect-size convention: eta-squared based on H
library(rstatix)
kruskal_effsize(df, score ~ group)Interpretation:
- \(p < 0.05\) → at least one group differs from the others. Like ANOVA, this is an omnibus test; it doesn’t tell you which specific groups differ.
- Report \(\eta^2_H\) from
rstatix::kruskal_effsize()regardless of significance. It is read like ANOVA’s \(\eta^2\): roughly the proportion of variability in the ranks explained by group.
13.3.2 Post-hoc tests after Kruskal-Wallis
If the Kruskal-Wallis is significant, follow up with pairwise comparisons:
pairwise.wilcox.test(df$score, df$group,
p.adjust.method = "BH")p.adjust.method controls how p-values are corrected for multiple comparisons:
"BH"(Benjamini-Hochberg) — controls false discovery rate. A reasonable default."bonferroni"— controls familywise error rate. More conservative."holm"— slightly less conservative than Bonferroni, with the same guarantee.
The output gives you a matrix of p-values for each pair of groups.
13.3.3 Friedman test (repeated measures)
Use when: You have three or more measurements on the same subjects (or matched sets) — the non-parametric equivalent of repeated-measures ANOVA.
Hypotheses:
- \(H_0\): The distributions of the repeated measures are identical.
- \(H_1\): At least one differs.
R syntax — wide format:
df <- data.frame(
subject = 1:5,
condA = c(5, 6, 7, 5, 6),
condB = c(6, 7, 6, 6, 7),
condC = c(7, 8, 6, 7, 8)
)
friedman.test(as.matrix(df[, c("condA", "condB", "condC")]))R syntax — long format:
# df_long has columns: subject, condition, score
df_long <- tidyr::pivot_longer(df, cols = c(condA, condB, condC),
names_to = "condition", values_to = "score")
friedman.test(score ~ condition | subject, data = df_long)
# Course effect-size convention: Kendall's W
rstatix::friedman_effsize(df_long, score ~ condition | subject)Interpretation:
- Significant Friedman test → at least one condition differs.
- Report Kendall’s W from
rstatix::friedman_effsize()regardless of significance. It runs from 0 (no consistent ordering of conditions across subjects) to 1 (every subject ranks the conditions the same way). For the example above, \(\chi^2(2) = 4.53\), p = .104, W = 0.45: a non-significant result with a moderate effect, which is what five subjects can give you. - For post-hoc pairwise comparisons, use
pairwise.wilcox.test()withpaired = TRUE, or loadPMCMRplusfor more sophisticated options (install it first; it isn’t in the Chapter 6 bundle).
13.4 Non-parametric correlation
13.4.1 Spearman’s rank correlation
Use when: You want to measure a monotonic relationship between two numeric variables without assuming linearity or normality. Spearman’s correlation operates on ranks.
Hypotheses:
- \(H_0\): No monotonic relationship.
- \(H_1\): There is a monotonic relationship (positive or negative).
R syntax:
x <- c(1, 2, 3, 7, 9, 10, 11, 12)
y <- c(2, 2, 5, 7, 8, 8, 10, 12)
cor.test(x, y, method = "spearman")These data include ties (two 2s and two 8s in y), so R adds Warning: cannot compute exact p-value with ties. That’s expected: R switches to an approximate p-value, which is fine to report.
Interpretation:
- The coefficient (\(\rho\)) ranges from \(-1\) to \(+1\).
- \(\rho = +1\) → perfect monotonic increase.
- \(\rho = -1\) → perfect monotonic decrease.
- \(\rho \approx 0\) → no monotonic relationship.
- The accompanying p-value tests whether \(\rho\) differs from zero.
13.4.2 Kendall’s tau
A second rank-based correlation. Often preferred for small samples or data with many tied ranks.
cor.test(x, y, method = "kendall")Same interpretation as Spearman. The two will usually give similar conclusions; Kendall’s \(\tau\) tends to be smaller in absolute value than Spearman’s \(\rho\).
13.5 Quick reference
| Situation | Parametric test | Non-parametric alternative |
|---|---|---|
| 2 independent groups | t.test() |
wilcox.test(y ~ group) |
| Paired data | t.test(post, pre, paired = TRUE) |
wilcox.test(post, pre, paired = TRUE) |
| 3+ independent groups | aov() |
kruskal.test() |
| 3+ repeated measures | RM-ANOVA / afex::aov_ez() |
friedman.test() |
| Continuous association | cor.test(..., method = "pearson") |
cor.test(..., method = "spearman") |
| Post-hoc after omnibus | Tukey HSD | pairwise.wilcox.test() |
13.6 Tips and good practices
- Check group sizes. Some non-parametric tests need a minimum number of observations per group to be reliable.
- Rank-based tests are robust to outliers, which is one of their main strengths — but they lose some information about the magnitude of differences. A 10-point difference and a 100-point difference count the same in the ranking.
- Exact vs. asymptotic p-values. For small datasets R may compute an exact p-value (which can be slow); for larger datasets it uses an asymptotic approximation. Use
exact = FALSEto force the asymptotic version when speed matters or when there are many tied ranks. - Multiple comparisons. When following up an omnibus test with pairwise comparisons, always correct for multiple testing (
p.adjust.method = "BH"is a sensible default). - Visualization. Box plots and strip plots show distributions much better than means for non-parametric work — they let the reader see what the rank-based test is testing.
13.7 A complete worked example
set.seed(123)
# Simulate three groups
group <- rep(c("A", "B", "C"), each = 10)
score <- c(rnorm(10, mean = 5, sd = 1),
rnorm(10, mean = 7, sd = 1),
rnorm(10, mean = 10, sd = 1))
df <- data.frame(group, score)
# Step 1: Visualize
boxplot(score ~ group, data = df,
main = "Score by group")
# Step 2: Omnibus test, with its effect size
kruskal.test(score ~ group, data = df)
rstatix::kruskal_effsize(df, score ~ group)
# If p < .05, at least one group differs
# Step 3: Pairwise follow-up
pairwise.wilcox.test(df$score, df$group,
p.adjust.method = "BH")The output of the pairwise call gives you p-values for A vs. B, A vs. C, and B vs. C, all corrected for multiple testing.
13.8 Reporting non-parametric results
Sample write-ups in APA-style prose. Each is built from this chapter’s own example code, so you can re-run it and find every number.
13.8.1 Mann-Whitney U
From the two-group example data at the start of the chapter — a non-significant result, reported in full, effect size included:
A Mann-Whitney U test found no significant difference between the treatment group (\(Mdn = 6.40\), \(IQR = 1.50\)) and the control group (\(Mdn = 6.30\), \(IQR = 1.90\)), \(U = 12.00\), \(p > .999\), \(r = .03\).
(R’s p is exactly 1; APA style writes that as \(p > .999\).)
13.8.2 Kruskal-Wallis with follow-up
From the complete worked example above:
A Kruskal-Wallis test indicated significant differences among the three groups (\(Mdn = 4.92\), \(7.38\), and \(9.32\) for A, B, and C), \(\chi^2(2) = 23.41\), \(p < .001\), \(\eta^2_H = .79\). Benjamini-Hochberg-corrected pairwise comparisons showed that every pair differed: A vs. B, \(p = .001\); A vs. C and B vs. C, both \(p < .001\).
13.8.3 Spearman’s correlation
From the x, y example data:
In the example data, x and y were strongly positively correlated, Spearman’s \(\rho = .99\), \(p < .001\).
Non-parametric tests are your toolkit when:
- Normality assumptions are violated and transformations don’t help.
- Your data are ordinal or rank-based.
- Small sample sizes prevent the Central Limit Theorem from saving you.
They are robust, easy to run, and conceptually straightforward. The main thing to remember: report medians (not means) as your descriptive statistic, the rank-based test statistic (R’s W, written as U for Mann-Whitney; \(\chi^2\); \(\rho\)) with its p-value, and an effect size regardless of significance.
Key terms from this chapter are defined in the Glossary.
Practice the skills from this chapter using real data: Non-parametric Tests Practice.
The next part of the book — the longest — covers the parametric workhorses themselves: t-tests, ANOVA, correlation, chi-square, and the long chapter on regression.
Module 5: Non-Parametric Alternatives uses two datasets chosen so the parametric and rank-based tests disagree, which forces the question of which one you would report and why. It also lets you measure the usual claim that non-parametric tests cost you power — on these data, the cost is smaller than the reputation suggests.
Worked in R alongside the page, in pairs, printed to PDF to hand in.
This module opens in a new tab.