hanegreefs.com/ statistics II
Home / Chapters / 11
Chapter 11 · Course ch. 23

Non-parametric methods

Rank-based tests: Mann–Whitney, signed-rank and Kruskal–Wallis, plus rank correlation.

About 13 min read · Lecture material: HOC 11

Priority labels: ImportantNeutralLess important show where to spend revision time.

Why go non-parametric?Important

Parametric methods (t-tests, regression) lean on assumptions about the shape of the population and on means being meaningful numbers. Non-parametric (distribution-free) methods replace the raw values by their ranks and ask whether the ranks look random. They are the right tool when:

SituationReason
Ordinal data (Likert scales, rankings)Numeric gaps are not meaningful, so a mean is not either
Small sample, clearly non-NormalThe CLT has not kicked in yet
Severe outliersRanks cap the influence of extreme values
Skewed or multi-modal datat-test assumptions fail
Monotone but curved relationsRanking straightens them (rank correlations)

They are not a way to hide an outlier you do not understand, a substitute for a sensible transformation, or a licence to ignore bimodality. There is a price too: with perfectly Normal data a rank test keeps roughly 95% of the power of its parametric twin; when assumptions fail, the rank test is the more reliable choice. Independence is still required — "distribution-free" does not mean "assumption-free".

Ranking rule: pool all observations, number them 1…N from smallest to largest, and give tied values the average of the ranks they occupy.

Parametric tests and their rank-based twinsImportant

SituationParametricNon-parametric
Two independent groupsTwo-sample tWilcoxon rank-sum / Mann–Whitney
Paired dataPaired tWilcoxon signed-rank
Three or more independent groupsOne-way ANOVAKruskal–Wallis
Association between two variablesPearson r / slope testSpearman ρ, Kendall τ

Wilcoxon rank-sum / Mann–Whitney testImportant

H₀: both groups come from the same distribution; H_A: one is shifted higher or lower. (For a clean "location" reading both groups should have the same shape.)

  1. Pool the N = n₁ + n₂ values and rank them, averaging ties.
  2. Add up the ranks of each group: T₁ and T₂. Check T₁ + T₂ = N(N+1)/2.
  3. Take T = the rank sum of the smaller group.
  4. n₁, n₂ ≤ 10: compare T with Table W1 — reject when T falls outside the tabulated interval. Larger samples: use the Normal approximation below.
Formula
E(T) = n(n₁ + n₂ + 1)/2, Var(T) = n₁n₂(n₁ + n₂ + 1)/12, z = (T − E(T)) / √Var(T)

(here n is the size of the group whose rank sum is T.)

Worked example

Two small groups

Group A: 12, 15, 9, 20, 17 (n = 5). Group B: 22, 25, 18, 30, 21, 27 (n = 6).

1

Pool and rank

9A=1, 12A=2, 15A=3, 17A=4, 18B=5, 20A=6, 21B=7, 22B=8, 25B=9, 27B=10, 30B=11
2

Rank sums

T_A = 1+2+3+4+6 = 16; T_B = 50; 16 + 50 = 66 = 11·12/2 ✓
3

Decide

T = 16 (smaller group). Its expected value under H₀ is 5·12/2 = 30 — far below. The exact two-sided p-value is ≈ 0.009
Answer

Reject H₀ at α = 0.05: group A tends to have lower values than group B. In the exam you would compare T = 16 with the W1 table interval for (5, 6); the conclusion is the same.

Kruskal–Wallis testImportant

The rank-based counterpart of one-way ANOVA for k ≥ 3 independent groups. H₀: all populations are identical; H_A: they are not all identical.

Formula
H = 12 / (N(N+1)) · Σ Tᵢ²/nᵢ − 3(N+1) → reject if H > χ²(k−1, α)
Worked example

Three groups of four

Group 1: 7, 9, 6, 11. Group 2: 12, 15, 10, 14. Group 3: 8, 13, 16, 18. (N = 12.)

1

Rank sums after pooling

T₁ = 13, T₂ = 31, T₃ = 34 (total 78 = 12·13/2 ✓)
2

Statistic

H = 12/(12·13) × (13² + 31² + 34²)/4 − 3·13 = 4.96
3

Compare

χ²(2, 0.05) = 5.99 → 4.96 < 5.99; p ≈ 0.084
Answer

Fail to reject H₀: there is some sign of group differences, but not enough at α = 0.05. A significant result would not say which groups differ — that needs post-hoc pairwise tests.

Wilcoxon signed-rank testImportant

For paired data when the differences are not near-Normal. H₀: the median difference is 0.

  1. Compute dᵢ for each pair; drop zeros, leaving n pairs.
  2. Rank the absolute differences |dᵢ| (average ties).
  3. T⁺ = sum of ranks with dᵢ > 0, T⁻ = sum of ranks with dᵢ < 0; check T⁺ + T⁻ = n(n+1)/2.
  4. Test statistic T = min(T⁺, T⁻).
  5. n ≤ 50: Table W2 — reject when T is smaller than the critical value. n > 50: Normal approximation.
Formula
E(T) = n(n+1)/4, Var(T) = n(n+1)(2n+1)/24, z = (T − E(T)) / √Var(T)
Worked example

Seven non-zero differences

Differences: 5, −2, 8, 3, −1, 6, 4 (an eighth pair with d = 0 was dropped).

1

Rank |d|

1→1(−), 2→2(−), 3→3, 4→4, 5→5, 6→6, 8→7
2

Rank sums

T⁻ = 1 + 2 = 3; T⁺ = 25; 3 + 25 = 28 = 7·8/2 ✓
Answer

T = 3. The exact two-sided p-value is ≈ 0.078, so at α = 0.05 we fail to reject; at α = 0.10 we would reject. Small T signals a shift, which is why the rejection rule here is "T too small".

Rank correlationsNeutral

Kendall's τ counts pairs: n_c concordant (higher x goes with higher y) and n_d discordant.

Formula
τ = (n_c − n_d) / ( n(n−1)/2 )

Spearman's ρ is Pearson's r computed on the ranks of x and of y. Both lie in [−1, 1], ignore the exact spacing of values, resist outliers and need only a monotone (not linear) trend. Quick check: x = 1…5 with y ranks 2, 1, 4, 3, 5 gives 8 concordant and 2 discordant pairs, so τ = 6/10 = 0.6, and ρ = 0.8.

Conditions at a glanceImportant

TestNeeds
Mann–WhitneyIndependence within and between groups; random sampling; same shape for a pure location reading
Kruskal–WallisIndependence within and between all groups; random sampling
Signed-rankPaired data; independent differences
Spearman / KendallIndependent observations; at least ordinal data

Calculator and RNeutral

The TI-84 has none of these tests built in: use SortA( to order the pooled data, assign ranks (averaging ties) by hand, then compare with the table or compute z with normalcdf and H with χ²cdf. For Spearman, rank x and y separately and run LinReg on the ranks. The rank calculators in the lab do the bookkeeping for you.

wilcox.test(a, b) # Mann–Whitney (ties: use exact = FALSE) wilcox.test(before, after, paired = TRUE) kruskal.test(y ~ group, data = d) cor.test(x, y, method = "spearman") cor.test(x, y, method = "kendall")

Key takeaways

  • Rank, add up, compare: T for two groups (smaller group), H for k groups (χ² with k − 1 df), min(T⁺, T⁻) for pairs.
  • Use rank methods for ordinal data, outliers and small non-Normal samples — not as an outlier-hiding trick.
  • Independence is always required; a significant Kruskal–Wallis does not say which groups differ.
Question
Tap or press space to reveal
Answer
Did you know it?

Multiple choice

Ch 11 · Question 1

Non-parametric tests replace the data by…

Why: Ranks.
Ch 11 · Question 2

Tied values receive…

Why: Average of the occupied ranks.
Ch 11 · Question 3

Rank-based twin of the paired t-test?

Why: Paired differences.
Ch 11 · Question 4

Kruskal–Wallis H is compared with χ² on…

Why: k groups.
Ch 11 · Question 5

Rank sums of two groups with N = 11 must add up to…

Why: 11·12/2 = 66.
Ch 11 · Question 6

Which is a legitimate reason for a rank test?

Why: Ordinal data.
Ch 11 · Question 7

Spearman's ρ is…

Why: Definition.
Ch 11 · Question 8

In the signed-rank test, zero differences are…

Why: Removed before ranking.

Exam-style questions

Exam-style · Ch 11

Two shops rate customer satisfaction on a 1–5 scale (n = 8 and 9). Why a rank test and how does it work?

Show outline of a full answer
  1. Ordinal data and small n → Mann–Whitney.
  2. Pool, rank (ties average), T = rank sum smaller group.
  3. Compare T with Table W1 or use Normal approximation.
  4. Conclude about shift in distributions.
Exam-style · Ch 11

For three training methods (4 trainees each) a Kruskal–Wallis test gives H = 6.4. Conclude at the 5% level and explain the next step.

Show outline of a full answer
  1. χ² with 2 df: critical 5.99 → reject H₀.
  2. At least one method differs in distribution.
  3. Post-hoc pairwise Mann–Whitney (with multiple-testing care).
  4. State independence and assumptions.

Rank test workbenchInteractive

Paste your values: it ranks them (with ties), computes T, E(T), z or H and a p-value.