Parametric vs. Non-parametric
Two Approaches to Testing
- Assume normal distribution
- Use raw data values
- More powerful (when assumptions met)
- t-tests, ANOVA, Pearson r
- 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
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
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.
Mann-Whitney U Test
Non-parametric Independent Samples Test
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
| Value | 12 | 14 | 15 | 16 | 18 | 20 | 22 | 25 |
|---|---|---|---|---|---|---|---|---|
| Rank | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| Group | A | B | A | B | A | B | A | B |
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 Value | Effect Size | Interpretation |
|---|---|---|
| 0.10 | Small | Minor difference in ranks |
| 0.30 | Medium | Moderate rank difference |
| 0.50 | Large | Substantial 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.
Wilcoxon Signed-Rank Test
Non-parametric Paired Test
| Subject | Before | After | Diff | |Diff| | Rank | Signed Rank |
|---|---|---|---|---|---|---|
| 1 | 50 | 55 | +5 | 5 | 2 | +2 |
| 2 | 48 | 52 | +4 | 4 | 1 | +1 |
| 3 | 55 | 45 | -10 | 10 | 4 | -4 |
| 4 | 60 | 68 | +8 | 8 | 3 | +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
Positive ranks: +1, +2, +3 → W⁺ = 6
Negative ranks: -4 → 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
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.
Kruskal-Wallis Test
Non-parametric One-Way ANOVA
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
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
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.
Spearman's Correlation
Rank-Based Correlation
- Raw values
- Linear relationships
- Assumes normality
- 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
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 ρ
| X | Y | Rank X | Rank Y | d | d² |
|---|---|---|---|---|---|
| 10 | 12 | 1 | 1 | 0 | 0 |
| 20 | 25 | 2 | 2 | 0 | 0 |
| 30 | 35 | 3 | 3 | 0 | 0 |
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.
Friedman Test
Non-parametric Repeated Measures
| Subject | Time 1 | Time 2 | Time 3 |
|---|---|---|---|
| 1 | Score (Rank) | Score (Rank) | Score (Rank) |
| 2 | Score (Rank) | Score (Rank) | Score (Rank) |
| ... | ... | ... | ... |
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
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
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
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
}
}
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
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"
}
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
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
}
}
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%