Module 12

Non-parametric Methods

Distribution-free tests for when assumptions fail

When Normal Isn't Normal

  • 01

    Rank-Based Tests

    Use data rankings instead of raw values

  • 02

    Distribution-Free

    No assumption about population distribution shape

  • 03

    Robust Statistics

    Less sensitive to outliers and violations

  • 04

    Ordinal Data

    Works with ranked or ordinal measurements

01

Parametric vs. Non-parametric

Two Approaches to Testing

Parametric Tests
  • Assume normal distribution
  • Use raw data values
  • More powerful (when assumptions met)
  • t-tests, ANOVA, Pearson r
Non-parametric Tests
  • No distribution assumptions
  • Use ranks or signs
  • Robust to violations
  • Mann-Whitney, Wilcoxon, Spearman

Parametric tests assume specific distribution shapes (usually normal) and estimate parameters like means. Non-parametric tests make fewer assumptions and work with ranks, making them more versatile but sometimes less powerful.

Choosing Your Approach

Use Non-parametric When:
Skewed Data
Highly asymmetric distributions
Outliers Present
Extreme values distort results
Ordinal Data
Rankings, Likert scales
Small Samples
Can't verify normality
Unknown Distribution
Novel measures
Median Comparison
When median is the focus

Non-parametric tests are ideal when data violates normality assumptions, contains outliers, or is measured on ordinal scales. They're also preferred for small samples where normality can't be reliably assessed.

How Ranking Works

Original data: 2, 5, 100, 8, 6
2
Rank 1
5
Rank 2
100
Rank 5
8
Rank 4
6
Rank 3
The outlier (100) becomes rank 5 - no longer dominates the analysis!

By converting data to ranks, extreme values lose their power to distort results. The outlier 100 is 50 times larger than 2, but in ranks, it's only 5 vs. 1. This is why non-parametric tests are robust to outliers.

02

Mann-Whitney U Test

Non-parametric Independent Samples Test

Alternative to: Independent t-test
Group A
Values: 12, 15, 18, 22
Combined ranks: 1, 3, 5, 7
Group B
Values: 14, 16, 20, 25
Combined ranks: 2, 4, 6, 8
H₀: The distributions of both groups are identical

The Mann-Whitney U test compares two independent groups by ranking all values together, then comparing rank sums. It tests whether one group tends to have higher values than the other, without assuming normality.

How to Calculate U

Step 1: Combine and rank all values
Value1214151618202225
Rank12345678
GroupABABABAB
Step 2: R₁ = 1+3+5+7 = 16, R₂ = 2+4+6+8 = 20
Step 3: U₁ = n₁n₂ + n₁(n₁+1)/2 - R₁ = 16 + 10 - 16 = 10

The U statistic counts how many times values in one group exceed values in the other. It ranges from 0 (no overlap) to n₁×n₂ (complete overlap). The p-value is calculated from U's sampling distribution.

Rank-Biserial Correlation

r = 1 - (2U / n₁n₂)
r ValueEffect SizeInterpretation
0.10SmallMinor difference in ranks
0.30MediumModerate rank difference
0.50LargeSubstantial rank difference

The rank-biserial correlation (r) is the effect size for Mann-Whitney U. It ranges from -1 to +1, with 0 indicating no difference. It tells you the probability that a randomly selected value from one group exceeds one from the other group.

03

Wilcoxon Signed-Rank Test

Non-parametric Paired Test

Alternative to: Paired t-test
SubjectBeforeAfterDiff|Diff|RankSigned Rank
15055+552+2
24852+441+1
35545-10104-4
46068+883+3

The Wilcoxon signed-rank test compares paired observations (before/after, matched pairs) by ranking the absolute differences and considering their signs. It tests whether the median difference is zero.

Computing the Test Statistic

From previous example:
Positive ranks: +1, +2, +3 → W⁺ = 6
Negative ranks: -4 → W⁻ = 4
Sum of positive ranks
W⁺ = 6
Sum of negative ranks
W⁻ = 4
Test statistic (smaller value)
W = min(W⁺, W⁻) = 4

The test statistic W is the smaller of W⁺ (sum of positive ranks) and W⁻ (sum of negative ranks). Small W values indicate the differences consistently go in one direction, suggesting a real effect.

Even Simpler Alternative

Sign Test: Ignores magnitude entirely
+
3 improvements
−
1 decline
Sign test only counts +/- signs (binomial test). Wilcoxon uses magnitude via ranks. Wilcoxon is more powerful when magnitudes are meaningful.

The sign test is an even simpler alternative that only counts positive vs. negative differences. It's less powerful than Wilcoxon but makes even fewer assumptions - useful when magnitude of differences isn't meaningful.

04

Kruskal-Wallis Test

Non-parametric One-Way ANOVA

Alternative to: One-way ANOVA
Group A
n=5, Mean Rank=4.2
Group B
n=5, Mean Rank=8.6
Group C
n=5, Mean Rank=11.2
H₀: All groups have the same distribution (equal medians)

Kruskal-Wallis extends Mann-Whitney to 3+ groups. It ranks all observations together and tests whether groups have different median ranks. Like ANOVA, a significant result means at least one group differs, but doesn't specify which.

The H Statistic

H = [12 / N(N+1)] × Σ(R²ᵢ/nᵢ) - 3(N+1)
N
Total observations
Rᵢ
Rank sum for group i
nᵢ
Sample size of group i
H follows χ² distribution with df = k - 1 (k = number of groups)

The H statistic measures how much the rank sums deviate from what's expected if all groups were equal. Larger H indicates more difference between groups. For large samples, H follows a chi-square distribution.

Following Up Significant Results

Post-hoc Options After Significant Kruskal-Wallis
Dunn's Test
Pairwise comparisons with Bonferroni correction. Most common choice.
Mann-Whitney with Correction
Pairwise U tests with adjusted alpha (e.g., Holm method).
Conover-Iman Test
Uses t-distribution for pairwise comparisons. More powerful.

Like ANOVA, Kruskal-Wallis only tells you that groups differ - not which ones. Dunn's test is the most common follow-up, performing pairwise comparisons with correction for multiple tests.

05

Spearman's Correlation

Rank-Based Correlation

Alternative to: Pearson's r
Pearson's r
  • Raw values
  • Linear relationships
  • Assumes normality
Spearman's ρ
  • Ranked values
  • Monotonic relationships
  • No distribution assumptions

Spearman's rho (ρ) measures the strength of a monotonic relationship - as one variable increases, the other tends to increase (or decrease). Unlike Pearson, it doesn't require linearity or normality.

Linear vs. Monotonic

Linear
r = ρ = 0.98
Monotonic (curved)
r = 0.89, ρ = 1.00

A monotonic relationship means Y consistently increases (or decreases) as X increases, but the rate can vary. Spearman's ρ = 1.0 for perfectly monotonic relationships, even if the curve isn't a straight line.

Calculating Spearman's ρ

ρ = 1 - (6Σd²) / [n(n²-1)]
where d = difference in ranks for each pair
XYRank XRank Ydd²
10121100
20252200
30353300
Σd² = 0 → ρ = 1.0 (perfect positive correlation)

Spearman's ρ is calculated from the differences in ranks. When ranks are identical (d=0 for all pairs), ρ = 1.0. It's actually Pearson's r computed on ranked data.

06

Friedman Test

Non-parametric Repeated Measures

Alternative to: Repeated Measures ANOVA
SubjectTime 1Time 2Time 3
1Score (Rank)Score (Rank)Score (Rank)
2Score (Rank)Score (Rank)Score (Rank)
............
Each subject's scores are ranked within that subject (1, 2, 3)

The Friedman test extends Wilcoxon signed-rank to 3+ related conditions. Each subject's scores across conditions are ranked within that subject, then rank sums are compared across conditions.

When to Use Friedman

Common Applications
Preference Rankings
Rate 5 products on preference
Longitudinal Studies
Same subjects at 3+ time points
Treatment Comparison
Same patients try 3+ treatments
Judge Ratings
Multiple items rated by same judges

Friedman is ideal when the same subjects are measured under multiple conditions, especially with ordinal data or non-normal distributions. Common in preference studies, clinical trials with multiple treatments, and longitudinal research.

Follow-Up Tests

After Significant Friedman Test
Nemenyi Test
Similar to Tukey's HSD. Compares all pairs.
Wilcoxon with Correction
Pairwise signed-rank tests with Bonferroni.
Conover Test
More powerful, uses F-distribution.

Like Kruskal-Wallis, a significant Friedman test only shows that conditions differ somewhere. Post-hoc tests identify which specific pairs differ. The Nemenyi test is most common for balanced designs.

★

Real-World Examples

Apply your knowledge to practical scenarios

01

Hospital Patient Satisfaction

A hospital measures patient satisfaction on a 1-10 scale across three units. The data is heavily skewed (most patients rate 8-10, but a few give very low ratings). Sample sizes: Unit A (n=45), Unit B (n=52), Unit C (n=38).

Sample Data
{
  "unit_a": {
    "median": 9,
    "iqr": "8-10",
    "n": 45
  },
  "unit_b": {
    "median": 8,
    "iqr": "6-9",
    "n": 52
  },
  "unit_c": {
    "median": 9,
    "iqr": "8-10",
    "n": 38
  }
}
Q Why is Kruskal-Wallis preferred over one-way ANOVA here? +
A The satisfaction ratings are bounded (1-10) and heavily skewed with ceiling effects. ANOVA assumes normally distributed data. Kruskal-Wallis makes no distribution assumptions and compares medians, which better represent typical ratings in skewed data.
Q If Kruskal-Wallis is significant (p = 0.02), what's the next step? +
A Perform Dunn's post-hoc test with Bonferroni correction to identify which pairs of units differ. You'll make 3 comparisons (A-B, A-C, B-C), so use α = 0.05/3 = 0.017 for each.
Key Insights
  • Skewed rating data often violates ANOVA assumptions
  • Kruskal-Wallis compares distributions via ranks
  • Always follow up with post-hoc tests to identify specific differences
02

Pain Medication Crossover Trial

12 chronic pain patients each try three medications (A, B, C) in randomized order with washout periods. Pain reduction is measured on a 100-point VAS scale. Some patients show extreme responses to certain medications.

Sample Data
{
  "design": "Repeated measures (same subjects, 3 conditions)",
  "n": 12,
  "variable": "Pain reduction (0-100 VAS)",
  "issue": "Non-normal data with extreme responses"
}
Q Why use Friedman test instead of repeated measures ANOVA? +
A With only 12 subjects and potential extreme responses, it's hard to verify normality assumptions. Friedman is robust to outliers and non-normality. It compares median pain reduction across the three medications.
Q How does the Friedman test handle the repeated measures structure? +
A Each patient's three pain scores are ranked within that patient (ranks 1, 2, 3). Then the test checks if one medication consistently gets higher ranks across patients. This controls for between-patient variability.
Key Insights
  • Crossover designs require repeated measures analysis
  • Friedman ranks within each subject, controlling for individual differences
  • Small samples make normality assumptions harder to verify
03

Mobile App Preference Study

100 users rank 4 navigation apps (Google Maps, Waze, Apple Maps, Here) from 1 (best) to 4 (worst). The data is inherently ordinal - we can't assume equal intervals between ranks.

Sample Data
{
  "apps": [
    "Google Maps",
    "Waze",
    "Apple Maps",
    "Here"
  ],
  "n": 100,
  "data_type": "Ordinal rankings (1-4)",
  "mean_ranks": {
    "google": 1.8,
    "waze": 2.1,
    "apple": 2.6,
    "here": 3.5
  }
}
Q Why can't we use ANOVA on ranking data? +
A Rankings are ordinal - we know the order (1st > 2nd > 3rd > 4th) but can't assume equal intervals. Being ranked 1st vs. 2nd might not be the same 'distance' as 3rd vs. 4th. ANOVA requires interval data.
Q What does a mean rank of 1.8 for Google Maps tell us? +
A Google Maps was typically ranked around 1st or 2nd by most users (mean rank 1.8 out of 4). Combined with Friedman test significance and post-hoc comparisons, we can determine if this preference is statistically reliable.
Key Insights
  • Ranking data is ordinal - use non-parametric methods
  • Friedman test compares mean ranks across conditions
  • Lower mean ranks indicate higher preference
?

Non-parametric Methods Quiz

Test your understanding • Passing score: 70%

0 of 10 answered
Q1 multiple-choice

When should you use a non-parametric test instead of a parametric test?

Explanation: Non-parametric tests are preferred when data violates normality assumptions (skewed distributions) or when data is measured on ordinal scales. Large samples with normal data are better suited for parametric tests.
Q2 multiple-choice

What is the non-parametric alternative to the independent samples t-test?

Explanation: The Mann-Whitney U test (also called Wilcoxon rank-sum test) compares two independent groups using ranks. The Wilcoxon signed-rank test is for paired data, and Kruskal-Wallis is for 3+ groups.
Q3 multiple-choice

How do non-parametric tests reduce the influence of outliers?

Explanation: Non-parametric tests convert raw values to ranks. An outlier value of 1000 becomes just the highest rank (e.g., 10 out of 10), having the same influence as a value of 50 that would also rank 10th.
Q4 multiple-choice

The Kruskal-Wallis test is the non-parametric alternative to:

Explanation: Kruskal-Wallis is the non-parametric alternative to one-way ANOVA, comparing 3 or more independent groups. It tests whether the groups have different median ranks.
Q5 multiple-choice

What does Spearman's correlation measure?

Explanation: Spearman's correlation (ρ) measures monotonic relationships - whether one variable tends to increase (or decrease) as the other increases, regardless of whether the relationship is linear.
Q6 multiple-choice

After a significant Kruskal-Wallis test with 4 groups, which post-hoc test is commonly used?

Explanation: Dunn's test is the standard post-hoc test for Kruskal-Wallis, performing pairwise comparisons of ranks with correction for multiple testing. Tukey's HSD is for parametric ANOVA.
Q7 multiple-choice

The Friedman test is appropriate when:

Explanation: The Friedman test is for repeated measures designs with 3 or more conditions - the same subjects measured under multiple conditions. It's the non-parametric alternative to repeated measures ANOVA.
Q8 multiple-choice

What is a key disadvantage of non-parametric tests when assumptions of parametric tests are actually met?

Explanation: When parametric assumptions are met, non-parametric tests have less power (lower probability of detecting real effects). They 'waste' information by discarding exact values and using only ranks.
Q9 multiple-choice

The sign test differs from the Wilcoxon signed-rank test because it:

Explanation: The sign test only counts how many differences are positive vs. negative, ignoring magnitude. Wilcoxon signed-rank test uses both direction and magnitude (via ranks), making it more powerful.
Q10 multiple-choice

If Pearson's r = 0.85 and Spearman's ρ = 0.98 for the same data, what does this suggest?

Explanation: When ρ > r, the relationship is monotonic (consistently increasing/decreasing) but curved rather than linear. Pearson captures linear relationships while Spearman captures any monotonic pattern.

Quiz Results

0 %

← Chi-Square Next: Correlation →