Module 5: Non-Parametric Alternatives

When Transformation Isn't the Answer

โ˜๏ธ Working Guidelines

0% Complete

๐ŸŽฏ Learning Objectives

By the end of this module, you will:

  1. Run wilcox.test() and kruskal.test() in R and read their output
  2. Compute and report a rank-based effect size for every test you run
  3. Produce a case where the t-test and Mann-Whitney reach opposite conclusions, and explain which to trust
  4. Translate R's W into the U your APA write-up requires
  5. Justify choosing a rank-based test over a transformation for a given dataset

๐Ÿค” What Are Non-Parametric Tests?

๐Ÿ“š The Big Picture

Parametric tests (t-test, ANOVA) make assumptions:

Non-parametric tests are "assumption-free":

The Trade-off:

Non-parametric tests are said to be about 95% as powerful as parametric tests when the data really are normal, but more powerful when the data are skewed or carry outliers. You do not have to take that on faith — in Part 8 you will measure both halves of it yourself.

Part 1: Common Non-Parametric Tests

Research Question Parametric Test Non-Parametric Alternative
Compare 2 independent groups Independent t-test Mann-Whitney U test
(also called Wilcoxon rank-sum)
Compare 2 paired/matched samples Paired t-test Wilcoxon signed-rank test
Compare 3+ independent groups One-way ANOVA Kruskal-Wallis test
Compare 3+ related groups Repeated-measures ANOVA Friedman test
Correlation between 2 variables Pearson's r Spearman's rho (ฯ)

Part 2: How Do Non-Parametric Tests Work?

๐Ÿ’ก The Ranking Trick

Non-parametric tests convert your data to ranks before analysis:

Example:

Original data: 50, 80, 85, 200, 220

Ranks: 1, 2, 3, 4, 5

Why this matters:

What are you testing?

Non-parametric tests ask: "Do the distributions differ?" rather than "Do the means differ?"

Part 3: ๐Ÿ”ฎ Commit to a Prediction

Do this before you run anything. In Part 4 you will analyse two datasets, each with a t-test and a Mann-Whitney test.

Predict: on which dataset, if either, will the two tests disagree with each other?




And a harder one: if they disagree, can the direction of the difference change too — not just whether it is significant? Write your prediction.

Part 4: Parametric vs. Non-Parametric, in R

Dataset A — clean, symmetric data

When assumptions are met, both tests should tell the same story.

set.seed(13) df_normal <- data.frame( score = c(rnorm(30, mean = 100, sd = 15), rnorm(30, mean = 112, sd = 15)), group = rep(c("Control", "Treatment"), each = 30) ) boxplot(score ~ group, data = df_normal, main = "Dataset A") t.test(score ~ group, data = df_normal) wilcox.test(score ~ group, data = df_normal, exact = FALSE)

exact = FALSE tells R to use the asymptotic approximation rather than the exact p-value — Chapter 13's default, and what you want once there are tied ranks.

Check your output for Dataset A
Welch Two Sample t-test data: score by group t = -3.2612, df = 56.398, p-value = 0.001885 95 percent confidence interval: -19.285372 -4.609759 sample estimates: mean in group Control mean in group Treatment 100.2558 112.2034 Wilcoxon rank sum test with continuity correction data: score by group W = 260, p-value = 0.005084

Both significant, same direction, same conclusion. The t-test's p is a little smaller — that is the ~5% efficiency cost of ranking, and it is the whole cost when the data are well behaved.

Dataset B — reaction times with three very slow participants

Everyone in the treatment condition responded faster, except three people who were dramatically slower than anyone else.

set.seed(998) control <- 200 + rexp(30, rate = 1/40) treatment <- c(160 + rexp(27, rate = 1/40), 820, 910, 1040) df_skewed <- data.frame( rt = c(control, treatment), group = rep(c("Control", "Treatment"), each = 30) ) boxplot(rt ~ group, data = df_skewed, main = "Dataset B") mean(control); mean(treatment) median(control); median(treatment) t.test(rt ~ group, data = df_skewed) wilcox.test(rt ~ group, data = df_skewed, exact = FALSE)

Question 1: Before opening the reveal — run the four descriptive lines and record them. Which group has the higher mean? Which has the higher median?

Control: mean median
Treatment: mean median

Check your output for Dataset B — open this after recording the descriptives
> mean(control); mean(treatment) [1] 230.7893 [1] 252.3119 > median(control); median(treatment) [1] 218.6445 [1] 171.9464 Welch Two Sample t-test data: rt by group t = -0.50777, df = 30.14, p-value = 0.6153 95 percent confidence interval: -108.07130 65.02604 sample estimates: mean in group Control mean in group Treatment 230.7893 252.3119 Wilcoxon rank sum test with continuity correction data: rt by group W = 784, p-value = 8.197e-07

Look at what just happened. The treatment group's mean is higher (252 vs 231) while its median is lower (172 vs 219). The two summaries point in opposite directions.

The t-test, which works on means, reports p = .62 — no evidence of any difference at all. The Mann-Whitney test, which works on ranks, reports p = .0000008.

Three participants did that. Their reaction times (820, 910, 1040 ms) are so far from everything else that they drag the treatment mean up past the control mean and inflate the variance enough to flatten the t-test. In the ranking, each of them is worth exactly one rank — the three highest — and the other 27 treatment participants still sit below almost every control participant.

๐Ÿ“ Observe & Analyze

Question 2: Was your Part 3 prediction right? Say what you predicted and what actually happened.

Question 3: On Dataset B the mean and the median disagree about which group is faster. Which one answers the question "did the treatment help a typical participant?" — and why?

Question 4: A colleague says "the t-test found nothing, so there is nothing there." Using Dataset B, explain in your own words why that reasoning fails.

Question 5: Dataset A showed the t-test with the slightly smaller p-value. Given that, why not just use Mann-Whitney for everything and never worry about normality again?

Part 5: Always Report an Effect Size

A p-value tells you the difference is probably not zero. It does not tell you how big it is. Report an effect size every time, significant or not.

library(rstatix) wilcox_effsize(df_skewed, rt ~ group)
.y. group1 group2 effsize n1 n2 magnitude 1 rt Control Treatment 0.6374928 30 30 large

This course's convention is Rosenthal's r. wilcox_effsize() returns r = Z / √N, which is 0.637 here. A different rank-based measure, the rank-biserial correlation, is 0.742 for the same data. It is legitimate, but it is not numerically interchangeable with Rosenthal's r. If other software reports it, name it explicitly; for course work, report the value from wilcox_effsize() as Rosenthal's r.

Part 6: R Says W. APA Says U.

This trips up almost everyone the first time.

wilcox.test() labels its statistic W. The APA convention for a two-group rank-sum test is U. They are the same number — only the name differs. Report R's value, call it U.

Strictly, a two-group comparison has two U values that sum to n1 × n2. For Dataset B:

W reported by R = 784 n1 * n2 = 30 * 30 = 900 the other U = 900 - 784 = 116

Report the one your software gives you (784) and say which test produced it. Do not silently rename the statistic or recompute it — a reader who reruns your analysis needs to land on your number.

Question 6: Write the APA sentence for Dataset B. Include the medians, the statistic with its correct label, the p-value, and the effect size with its name.

Part 7: More Than Two Groups — Kruskal-Wallis

Satisfaction ratings on a 1–7 scale across three departments. Ratings are ordinal, so a rank-based test is the right call regardless of what any normality test says.

set.seed(13) satisfaction <- data.frame( rating = c(sample(1:7, 25, replace = TRUE, prob = c(3,4,5,5,4,2,1)), sample(1:7, 25, replace = TRUE, prob = c(1,2,3,5,5,4,3)), sample(1:7, 25, replace = TRUE, prob = c(1,1,2,3,5,6,6))), dept = rep(c("Billing", "Support", "Sales"), each = 25) ) tapply(satisfaction$rating, satisfaction$dept, median) kruskal.test(rating ~ dept, data = satisfaction) pairwise.wilcox.test(satisfaction$rating, satisfaction$dept, p.adjust.method = "BH")
Check your output
Billing Sales Support 4 6 4 Kruskal-Wallis rank sum test data: rating by dept Kruskal-Wallis chi-squared = 23.51, df = 2, p-value = 7.849e-06 Pairwise comparisons using Wilcoxon rank sum exact test data: satisfaction$rating and satisfaction$dept Billing Sales Sales 3.5e-06 - Support 0.16826 0.00029 P value adjustment method: BH

Kruskal-Wallis is an omnibus test: it says at least one department differs, not which. The pairwise follow-up shows Sales differs from both Billing and Support, while Billing and Support do not differ from each other (p = .17) — which matches the medians (6, 4, 4).

p.adjust.method = "BH" corrects for running three comparisons. Never skip it.

Question 7: The omnibus p is .0000078, but one of the three pairwise comparisons is .17. Explain to a classmate why those are not contradictory.

Part 8: Measure the 95% Claim Yourself

Back at the top, this module claimed non-parametric tests are ~95% as powerful when data are normal, and more powerful when data are skewed. Test it.

power_pair <- function(gen_c, gen_t, n, reps = 2000) { res <- replicate(reps, { a <- gen_c(n); b <- gen_t(n) c(t.test(b, a)$p.value < .05, wilcox.test(b, a, exact = FALSE)$p.value < .05) }) c(t = mean(res[1, ]), wilcox = mean(res[2, ])) } set.seed(13) # normal populations power_pair(function(n) rnorm(n, 100, 15), function(n) rnorm(n, 108, 15), 30) set.seed(13) # skewed populations power_pair(function(n) 200 + rexp(n, 1/40), function(n) 175 + rexp(n, 1/40), 30)
Check your output
t wilcox 0.5485 0.5175 # normal -> ratio 0.943 t wilcox 0.6790 0.8945 # skewed -> ratio 1.317
Datat-testMann-WhitneyRatio
Normal54.9%51.8%0.94
Skewed67.9%89.5%1.32

The claim holds, and you measured it. On normal data the rank test retains 94% of the t-test's power — the textbook figure is 95.5%, and 2,000 simulations will land near it. On skewed data the rank test is 32% more powerful.

So the "cost" of going non-parametric on well-behaved data is about six percentage points of power. The cost of not going non-parametric on badly behaved data was Dataset B.

Question 8: Record the four power values. Given the ratio on normal data, is the "~95% as powerful" claim fair? Given the skewed row, restate the trade-off in one sentence you would actually say out loud.

Part 4: When to Use Non-Parametric Tests

โœ“ USE Non-Parametric Tests When:

1. Data are clearly non-normal AND small sample

n < 30 and severe skewness or outliers โ†’ Use non-parametric

2. Data are ordinal

Likert scales (1-5 ratings), rankings โ†’ Non-parametric is appropriate

3. Transformation doesn't work or is too complex

Tried log, sqrt, etc., but still not normal โ†’ Use non-parametric

4. You want robustness

Worried about outliers influencing results โ†’ Non-parametric is more robust

5. Your research question is about distributions, not just means

"Do groups differ?" is broader than "Do means differ?" โ†’ Non-parametric

โš ๏ธ DON'T Automatically Use Non-Parametric If:

1. You have large samples (n > 50-100) with mild violations

Parametric tests are robust; transformation may be easier

2. Your field expects parametric tests

Consider using parametric + reporting assumption checks + sensitivity analysis

3. You need specific comparisons (post-hocs)

Parametric post-hoc tests are more developed than non-parametric equivalents

4. Interpretation is important

Means are easier to interpret than "sum of ranks"

Part 5: Decision Flowchart

๐Ÿ—บ๏ธ Complete Decision Guide

Step 1: Check normality

Step 2: Decide based on results + sample size

Step 3: Report clearly

Always report which test you used and why!

Part 6: Real-World Scenarios

Scenario A: You're comparing pain ratings (1-10 scale) between treatment and control groups (n=25 each). Data are skewed right. What do you do?

Scenario B: You have reaction time data (n=80 per group). Right-skewed. Shapiro-Wilk p = 0.001. Q-Q plot shows moderate deviation. What do you do?

Scenario C: Survey with satisfaction ratings (Very Dissatisfied to Very Satisfied, n=200). Compare 3 departments. What test?

Scenario D: Income data from 40 people, comparing two cities. Heavily right-skewed with outliers (a few millionaires). What do you do?

Part 7: Reporting Non-Parametric Results

๐Ÿ“ How to Report

Bad example:

"We used a Mann-Whitney test. p = 0.03."

Good example:

"Data were not normally distributed (Shapiro-Wilk: W = 0.89, p = 0.003) and transformation did not improve normality. We therefore used the Mann-Whitney U test to compare groups. The treatment group (Mdn = 85) scored significantly higher than the control group (Mdn = 72), U = 245, p = .031, r = .34 (Rosenthal's r)."

Note the two details this sentence gets right that most student write-ups miss: the statistic is called U even though R printed W (Part 6), and the effect size is named rather than left as a bare r (Part 5).

Key elements to include:

๐ŸŽฏ Key Takeaways

What You Should Remember:

โœ“ Non-parametric tests are not "inferior"

They're just different! ~95% power when assumptions hold, MORE power when violated.

โœ“ They test distributions, not means

The question changes from "Are means different?" to "Are distributions different?"

โœ“ Use ranks, not raw values

This makes them robust to outliers and skewness.

โœ“ Main alternatives:

โœ“ When to use them:

โœ“ Always report why you chose non-parametric

Document your assumption checking and decision-making process!

๐Ÿ“š Course Complete!

๐ŸŽ‰ Congratulations!

You've now completed the entire normality testing curriculum!

Module 1: Why normality matters (Type I error inflation)

Module 2: Visual detection (histograms, Q-Q plots)

Module 3: Statistical tests (Shapiro-Wilk, large sample paradox)

Module 4: Transformations (log, sqrt, when to transform)

Module 5: Non-parametric alternatives (Mann-Whitney, Kruskal-Wallis)

You now have a complete toolkit for handling normality in your research!

๐Ÿ“‹ Before You Submit

โœ… Submission Checklist

Grading: Credit/no-credit, not scored for correctness — but credit requires a genuine attempt; blank or clearly-unattempted answers earn no credit. Work through it with your partner and say what you actually think; a wrong idea you reasoned your way to is worth more here than a right one you copied.

๐Ÿ“ค How to Submit

  1. Click "Save Progress"
  2. Print: Ctrl+P (Windows) or Cmd+P (Mac)
  3. Choose "Save as PDF"
  4. Save as: module5_lastname1_lastname2.pdf
  5. Upload to your course site

๐ŸŽ‰ You've completed all 5 modules! ๐ŸŽ‰

You're now equipped to handle normality testing like a pro!

Next: Apply these skills to your own research data!