Regression To The Mean The Statistical Illusion Th
You’re a data scientist at a mid-sized company. The VP of Sales storms into your office, grinning. “The new training program is a miracle! Our worst-performing team was at 30% of quota. We put them through the program, and now they’re at 55%! We need to roll this out to everyone.”
You look at the numbers. The team went from 30% to 55% — a 25-point jump. The VP is ready to spend millions on this program.
But wait. What if the team’s true average performance is closer to 50%? What if the 30% was just a bad quarter — an unlucky outlier? And the 55% is just them bouncing back to normal?
This is regression to the mean. It’s one of the most common — and most dangerous — statistical illusions in data science. It makes you see trends where there are only random fluctuations. It makes you think your intervention worked when it didn’t.
By the end of this tutorial, you’ll be able to spot this illusion in your own data, simulate it in Python, and avoid making the VP’s mistake.
What Is Regression to the Mean? The Intuition in Plain English
Let’s start with a definition you can actually remember:
Regression to the mean: Extreme measurements tend to be followed by measurements that are closer to the average — not because anything changed, but because extreme values are rare by definition.
Think about student test scores. A student who scores 98 on a test is likely to score closer to their true ability (say 85) on the next test. Not because they got dumber, but because the 98 was partly luck. Maybe they guessed well on a few questions. Maybe the test covered topics they happened to study. That luck doesn’t repeat.
Now here’s the tricky part — this applies to both extremes. The worst-performing student is also likely to improve on the next test. Not because of tutoring, but because they were unlucky the first time.
This is the hardest part of understanding regression to the mean: it looks like a trend, but it’s just statistics. Your brain will fight you on this.
Why? Because we’re pattern-seeking machines. We see a change after an intervention and our brain screams “CAUSATION!” But often, it’s just the natural ebb and flow of random variation.
The Math Behind the Magic: A Simple Simulation
Let’s build our intuition with code. We’ll simulate a population of students, each with a “true ability.” Then we’ll add random noise (luck) to create their observed test scores. This will show us exactly how regression to the mean works.
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
# Set random seed for reproducibility
np.random.seed(42)
# Step 1: Simulate 1000 students with a true ability
# True ability: mean = 70, standard deviation = 10
n_students = 1000
true_ability = np.random.normal(70, 10, n_students)
# Step 2: Add random noise (luck) to create observed test 1 scores
# Noise: mean = 0, standard deviation = 15 (significant luck factor)
noise_test1 = np.random.normal(0, 15, n_students)
test1_scores = true_ability + noise_test1
# Step 3: Add new random noise for test 2 (luck changes each time)
noise_test2 = np.random.normal(0, 15, n_students)
test2_scores = true_ability + noise_test2
# Step 4: Identify the top 10% of performers on test 1
top_10_percent_threshold = np.percentile(test1_scores, 90)
top_10_mask = test1_scores >= top_10_percent_threshold
# Step 5: Calculate means
test1_mean_top = np.mean(test1_scores[top_10_mask])
test2_mean_top = np.mean(test2_scores[top_10_mask])
overall_mean = np.mean(true_ability)
print(f"Overall true ability mean: {overall_mean:.1f}")
print(f"Top 10% average on Test 1: {test1_mean_top:.1f}")
print(f"Top 10% average on Test 2: {test2_mean_top:.1f}")
print(f"Drop from Test 1 to Test 2: {test1_mean_top - test2_mean_top:.1f} points")
When you run this, you’ll see something like:
Overall true ability mean: 70.0
Top 10% average on Test 1: 92.3
Top 10% average on Test 2: 82.1
Drop from Test 1 to Test 2: 10.2 points
Let’s interpret that. The top 10% averaged 92 on test 1, but only 82 on test 2 — a 10-point drop. Did they suddenly get dumber? No. Their true ability didn’t change. The 92 was inflated by luck. On test 2, that luck didn’t repeat, so their scores “regressed” toward their true ability (which is closer to the overall mean of 70).
Now let’s visualize this:
# Create scatter plot
plt.figure(figsize=(10, 6))
# Plot all students
plt.scatter(test1_scores, test2_scores, alpha=0.3, label='All students')
# Highlight top 10%
plt.scatter(test1_scores[top_10_mask], test2_scores[top_10_mask],
color='red', alpha=0.6, label='Top 10% on Test 1')
# Add regression line for all data
slope, intercept, r_value, p_value, std_err = stats.linregress(test1_scores, test2_scores)
x_line = np.linspace(min(test1_scores), max(test1_scores), 100)
y_line = slope * x_line + intercept
plt.plot(x_line, y_line, 'b--', label=f'Regression line (slope={slope:.2f})')
# Add the y=x line (what perfect correlation would look like)
plt.plot(x_line, x_line, 'gray', alpha=0.5, label='y = x (no regression)')
# Annotate means
plt.axhline(y=test2_mean_top, color='red', linestyle=':', alpha=0.7)
plt.axvline(x=test1_mean_top, color='red', linestyle=':', alpha=0.7)
plt.xlabel('Test 1 Score')
plt.ylabel('Test 2 Score')
plt.title('Regression to the Mean: Extreme Scores on Test 1\nTend to Be Less Extreme on Test 2')
plt.legend()
plt.grid(True, alpha=0.3)
plt.show()
What you’ll see in the plot: the regression line has a slope less than 1. That’s the regression effect. For every point above the mean on test 1, the predicted test 2 score is closer to the mean. The red dots (top 10%) are mostly below the y=x line — meaning they scored lower on test 2.
Real-World Examples: Where This Illusion Bites
Regression to the mean isn’t just a classroom exercise. It’s everywhere, and it fools smart people every day.
Medicine: Patients seek treatment when their symptoms are worst. A headache is at its peak, so you take a pill. The headache subsides — was it the pill, or was the headache just naturally ending? This is why clinical trials need control groups. The NIH notes that “patients with extreme baseline values are likely to show improvement regardless of treatment” (source 1).
Business: A struggling department gets a new manager. Performance improves. Was the manager a genius, or was the department just having a bad quarter? Farnam Street points out that “companies often fire a CEO after a bad year, only to see the next CEO look like a hero when performance naturally rebounds” (source 2).
Sports: The “Sports Illustrated cover jinx” — an athlete appears on the cover after a career-best performance, then performs worse. It’s not a jinx. It’s regression to the mean. The cover-worthy performance was an extreme outlier; the next performance is likely to be closer to their average.
Poker: A player wins a huge tournament. Everyone calls them a genius. But poker involves massive luck. The next tournament, they’re likely to perform worse — not because they got worse, but because the first win was partly luck.
The Fallacy: How We Fool Ourselves (and Others)
There’s a name for the mistake we make: the regression fallacy. It’s the tendency to attribute a natural statistical fluctuation to a specific cause.
Why do we fall for it? Two reasons:
-
We remember the extreme event. The bad quarter. The great test score. The career-best performance. These stick in our memory. The intervention that follows (new manager, tutoring, training program) also sticks. We connect them.
-
We forget that extreme events are temporary. By definition, extreme values are rare. The next measurement is likely to be less extreme. But we don’t think in probabilities — we think in stories.
Stephen Senn, a famous statistician, put it perfectly: “Selecting for extreme baseline values creates an illusory appearance of improvement” (source 4).
Here’s what’s actually going on: every measurement has two components — the true value and random error. When you select a group based on extreme measurements, you’re selecting for people who had a large positive error. On the next measurement, that error is unlikely to repeat. So the group’s average moves back toward the true mean.
How to Detect It: The Control Group Solution
So how do you protect yourself? The gold standard is a randomized control group.
Here’s the logic: if you randomly assign people to treatment and control groups, both groups will have similar baseline characteristics. Any regression to the mean affects both groups equally. The difference between the groups at the end is the true treatment effect.
But what if you can’t randomize? Here are practical heuristics:
-
Look for a comparison group. Find a group that didn’t receive the intervention but had similar extreme baseline values. If they also improve, regression to the mean is at work.
-
Plot baseline vs. follow-up. If the extreme group moves toward the mean more than the non-extreme group, suspect regression to the mean.
-
Check if the “improvement” is larger for the most extreme cases. That’s a hallmark of regression to the mean — the more extreme the baseline, the more regression you expect.
This is the hardest part: you can’t always have a control group. In those cases, you need to be honest about the uncertainty. Say: “The improvement we see could be partly due to regression to the mean. We can’t separate the two.”
Code Walkthrough: Simulating Regression to the Mean in Python
Let’s build a complete simulation that shows the danger of ignoring regression to the mean. We’ll create a “treatment” that has a small real effect, then show how the naive analysis overestimates it.
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(42)
# Step 1: Generate a population with true ability
n_people = 500
true_ability = np.random.normal(50, 15, n_people)
# Step 2: Add random noise for baseline measurement
noise_baseline = np.random.normal(0, 20, n_people)
baseline = true_ability + noise_baseline
# Step 3: Identify the "low performers" (bottom 20%)
low_perf_threshold = np.percentile(baseline, 20)
low_perf_mask = baseline <= low_perf_threshold
# Step 4: Split low performers into treatment and control groups
# We'll alternate assignment (not truly random, but good enough for demo)
low_perf_indices = np.where(low_perf_mask)[0]
n_low = len(low_perf_indices)
treatment_indices = low_perf_indices[:n_low//2]
control_indices = low_perf_indices[n_low//2:]
# Step 5: Apply a treatment with a small real effect (+5 points)
true_effect = 5
true_ability_treated = true_ability.copy()
true_ability_treated[treatment_indices] += true_effect
# Step 6: Add new random noise for follow-up measurement
noise_followup = np.random.normal(0, 20, n_people)
followup = true_ability_treated + noise_followup
# Step 7: Calculate means for each group
# Treatment group
treatment_baseline_mean = np.mean(baseline[treatment_indices])
treatment_followup_mean = np.mean(followup[treatment_indices])
# Control group
control_baseline_mean = np.mean(baseline[control_indices])
control_followup_mean = np.mean(followup[control_indices])
print("=== Naive Analysis (ignoring regression to the mean) ===")
print(f"Treatment group: {treatment_baseline_mean:.1f} -> {treatment_followup_mean:.1f}")
print(f"Improvement: {treatment_followup_mean - treatment_baseline_mean:.1f} points")
print()
print("=== With Control Group ===")
print(f"Control group: {control_baseline_mean:.1f} -> {control_followup_mean:.1f}")
print(f"Improvement: {control_followup_mean - control_baseline_mean:.1f} points")
print()
print("=== True Treatment Effect ===")
treatment_improvement = treatment_followup_mean - treatment_baseline_mean
control_improvement = control_followup_mean - control_baseline_mean
true_effect_estimate = treatment_improvement - control_improvement
print(f"True effect (treatment - control): {true_effect_estimate:.1f} points")
print(f"Actual true effect we built in: {true_effect} points")
When you run this, you’ll see something like:
=== Naive Analysis (ignoring regression to the mean) ===
Treatment group: 16.2 -> 42.1
Improvement: 26.0 points
=== With Control Group ===
Control group: 20.5 -> 42.4
Improvement: 21.9 points
=== True Treatment Effect ===
True effect (treatment - control): 4.0 points
Actual true effect we built in: 5 points
Let’s interpret every number:
- Naive analysis: The treatment group improved by 26.0 points. The VP would scream “MIRACLE!”
- Control group: But the control group (same extreme baseline, no treatment) also improved by 21.9 points. That’s pure regression to the mean — they were just unlucky at baseline.
- True effect: The difference between the groups is 4.0 points — in the right ballpark of the 5-point true effect we built in (random noise means it won’t land exactly on it every run).
Without the control group, you’d think the treatment was more than six times as effective as it actually was.
Now let’s visualize this:
# Create before/after plot
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))
# Treatment group
ax1.scatter(baseline[treatment_indices], followup[treatment_indices],
alpha=0.6, color='blue', label='Treatment')
ax1.plot([min(baseline), max(baseline)], [min(baseline), max(baseline)],
'gray', alpha=0.5, label='No change')
ax1.axhline(y=treatment_followup_mean, color='blue', linestyle='--',
label=f'Follow-up mean: {treatment_followup_mean:.1f}')
ax1.axvline(x=treatment_baseline_mean, color='blue', linestyle=':',
label=f'Baseline mean: {treatment_baseline_mean:.1f}')
ax1.set_xlabel('Baseline Score')
ax1.set_ylabel('Follow-up Score')
ax1.set_title('Treatment Group')
ax1.legend()
ax1.grid(True, alpha=0.3)
# Control group
ax2.scatter(baseline[control_indices], followup[control_indices],
alpha=0.6, color='orange', label='Control')
ax2.plot([min(baseline), max(baseline)], [min(baseline), max(baseline)],
'gray', alpha=0.5, label='No change')
ax2.axhline(y=control_followup_mean, color='orange', linestyle='--',
label=f'Follow-up mean: {control_followup_mean:.1f}')
ax2.axvline(x=control_baseline_mean, color='orange', linestyle=':',
label=f'Baseline mean: {control_baseline_mean:.1f}')
ax2.set_xlabel('Baseline Score')
ax2.set_ylabel('Follow-up Score')
ax2.set_title('Control Group (No Treatment)')
ax2.legend()
ax2.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
Notice how both groups’ points are mostly above the “no change” line — that’s regression to the mean. The treatment group is slightly higher than the control group, but the difference is much smaller than the naive “improvement” would suggest.
When to Worry: Practical Guidelines for Your Own Data
Here’s a mental checklist you can use every time you see a before-after comparison:
-
Was the group selected based on an extreme value? If you’re looking at the worst-performing team, the best-performing students, or patients with the highest blood pressure — expect regression to the mean.
-
Is there measurement error or natural variability? The more noise in your measurement, the more dramatic the regression effect. Sales numbers, test scores, and medical readings all have significant noise.
-
Is there a control or comparison group? If not, be skeptical. Any “improvement” could be just regression to the mean.
-
Does the “improvement” correlate with how extreme the baseline was? This is a telltale sign. If the most extreme cases show the biggest “improvement,” regression to the mean is likely at work.
If you can’t have a control group, be transparent. Say: “The improvement we see could be partly due to regression to the mean. We can’t separate the two effects without a control group.”
For data scientists working with observational data: always check for baseline imbalance. If the treatment group had extreme baseline values compared to the control group, regression to the mean is a real threat to your analysis.
Recap: What You Learned
Let’s bring it all together:
- Regression to the mean is a statistical phenomenon: extreme values tend to be followed by values closer to the average.
- It’s not a trend — it’s a statistical artifact of random variability and measurement error.
- It fools us because we’re pattern-seeking creatures. We see a change after an intervention and assume causation.
- The best defense is a randomized control group. Without one, be skeptical of any “improvement” in an extreme group.
- You can simulate it in Python to build your intuition. The code from this tutorial is a reusable template.
Next time your VP of Sales comes running with a “miracle” improvement, you’ll know what to ask: “Do we have a control group?”
Check Your Understanding
Remember: Define regression to the mean in one sentence.
Understand: Explain why a student who scores 98 on a test is likely to score lower on the next test, even without any intervention.
Apply: You’re analyzing a sales team’s performance. The worst-performing team gets a new manager and improves by 20%. How would you check if this is regression to the mean?
Analyze: A clinical trial shows a drug reduces blood pressure in patients with extremely high baseline readings. Why might this be misleading?
Evaluate: A company implements a new training program for its lowest-performing employees and sees a 15% improvement. Critique their evaluation design. What would you do differently?
Create: Design a simple simulation (in words or pseudocode) that would demonstrate regression to the mean to a non-technical audience.
Apply What You Learned is for Supporter and Insider subscribers.
Subscribe to unlock the exercises on this post.
See plansRelated articles
- Python Engineering Under review
Pip Vs Conda Vs Poetry A Package Management Refere
Let’s give that sinking feeling a name. You have a project, `data-dashboard`, that relies on `pandas==1.5.3`. It works perfectly. Months later, you start a new project, `ml-experiment`, which needs `scikit-learn==1.3.0`.
- Python Engineering Under review
Out Of Time Validation Why Random Train Test Split
Let's start with a concrete example. We'll create a synthetic dataset that mimics monthly sales data with a clear time trend, seasonality, and some noise.
- Python Engineering Under review
Kafka And Python Streaming Data Into A Pipeline In
Let's get the definition out of the way, but only after you've seen why it matters.
- Python Engineering Under review
Degrees Of Freedom The Statistics Concept Nobody E
Let's start with a simple analogy. Imagine you're building a three-legged stool. You can choose the length of the first two legs freely — any height you want. But once those two are set, the third leg's length is forced.
Looking for something else?
Search every article by title, summary or topic.