Published on
· July 10, 2026

Simpson's Paradox: when aggregated data deceives

Blog
  • Photo of Renata Weber
    Renata Weber
    Renata Weber
    Growth Specialist at Pareto Plus

    Growth Specialist at Pareto Plus

Abstract scatter plots illustrating Simpson's Paradox in data analysis

Simpson's Paradox is a statistical phenomenon where a trend observed in several subgroups of data reverses or disappears when the groups are combined. It exposes the risk of trusting only aggregated averages, leading data scientists to conclusions opposite to the real ones.

What is Simpson's Paradox?

Simpson's Paradox is a trend reversal: a relationship that appears consistently in subsets of data vanishes or changes direction when those subsets are aggregated. An option that wins in each isolated group can lose in the total, depending on how the observations are distributed.

The phenomenon was described by statistician Edward H. Simpson in a 1951 paper, although Karl Pearson (1899) and Udny Yule (1903) had already noticed similar effects — hence the alternative name "Yule-Simpson effect". The term "Simpson's Paradox" was only coined by Colin R. Blyth in 1972, according to the Stanford Encyclopedia of Philosophy.

The root of the problem is almost never the calculation, but the interpretation. When there is a confounding variable — a third variable linked to both the group and the outcome — the aggregated average weights the groups in a distorted way. Understanding this mechanism is a central part of reasoning in Data Science.

What is the most famous example of Simpson's Paradox?

The most cited case is the 1973 graduate admissions at the University of California, Berkeley. The aggregated numbers seemed to denounce gender bias: about 44% of male applicants were accepted, compared with only 35% of women. At first glance, the difference suggested institutional discrimination.

When disaggregated by department, however, the picture reversed: in most departments women had an admission rate equal to or higher than men's. The explanation is a confounding variable — women applied more often to highly competitive areas with few openings, while men concentrated in courses with easier admission.

The statisticians Peter Bickel, Eugene Hammel and J. William O'Connell published the analysis in the journal Science in 1975, concluding there was no "pattern of discrimination on the part of the admissions committees". It is the definitive demonstration that aggregation without context deceives.

How to reproduce Simpson's Paradox in Python?

To make the effect concrete, consider an illustrative example of two streaming platforms, A and B, measuring the recommendation conversion rate across two user groups: new and recurring subscribers. The numbers below are fictional, but replicate the mechanics of the paradox.

GroupPlatform APlatform B
New93% (81/87)87% (234/270)
Recurring73% (192/263)69% (55/80)
Total78% (273/350)83% (289/350)

Platform A wins in both subgroups, but Platform B wins in the total. The reason is the uneven distribution: most of B's users are in the "new" group, which has a high rate, while A concentrates users in the "recurring" group, with a lower rate. The pandas library reproduces the calculation:

import pandas as pd

dados = {
    'plataforma': ['A', 'A', 'B', 'B'],
    'grupo': ['novos', 'recorrentes', 'novos', 'recorrentes'],
    'conversoes': [81, 192, 234, 55],
    'total': [87, 263, 270, 80],
}
df = pd.DataFrame(dados)
df['taxa'] = df['conversoes'] / df['total']

subgrupo = df.pivot(index='grupo', columns='plataforma', values='taxa')
print(subgrupo)  # taxa por subgrupo: A vence em ambos

agregado = df.groupby('plataforma')[['conversoes', 'total']].sum()
agregado['taxa'] = agregado['conversoes'] / agregado['total']
print(agregado)  # taxa agregada: B vence no geral — o paradoxo aparece

The common mistake is applying groupby('plataforma').mean() over already-calculated rates, which ignores the size of each group. The correct average weights by the totals, exactly as in the Berkeley example.

How to visualize Simpson's Paradox with matplotlib and seaborn?

Visualization is the fastest way to catch the trend reversal. With matplotlib and seaborn, you plot each subgroup separately and observe whether the direction changes when looking at the combined set. In continuous data, the paradox shows up as regression lines that rise within each group but fall in the aggregate.

import seaborn as sns
import matplotlib.pyplot as plt

sns.lmplot(data=df, x='total', y='taxa', hue='grupo', height=5)  # reta por subgrupo
plt.title('Paradoxo de Simpson: tendência por subgrupo x agregado')
plt.show()

This kind of chart visually exposes what an aggregated table hides. The same care with the level of analysis applies to predictive models: in a Linear Regression, ignoring a confounding variable can reverse the sign of a coefficient and sabotage the entire interpretation of the model.

How to deal with Simpson's Paradox in Data Science?

Simpson's Paradox is not solved with a single formula, but with analytical discipline. When working with large data sets, three practices drastically reduce the risk of drawing reversed conclusions. Here at CodeCrush, we sum up this discipline in three steps:

  1. Awareness — Assume that aggregated averages can lie. Whenever there are plausible subgroups, examine disaggregated data before communicating any result.
  2. Detailed analysis — Identify possible confounding variables and segment by them. Compare the metric per subgroup and in total, checking whether the trend direction holds.
  3. Clear visualization — Use scatter plots and regression lines per group to make the reversal visible. The human eye detects patterns that an aggregated table hides.

When does the level of analysis matter?

The decisive question is causal, not statistical: which variable actually explains the outcome? The answer defines whether you should report the aggregated or the segmented data. Without understanding the problem domain, no calculation alone points to the correct level.

Conclusion

Simpson's Paradox is a reminder that data does not speak for itself — what speaks is the interpretation. Before announcing that "A is better than B", the good analyst asks: better for whom, and in which slice? The answer almost always requires looking at the subgroups and the confounding variables behind the average. Master this healthy suspicion and you will avoid most wrong conclusions in Data Science projects, with or without Python.

## faq

Frequently asked questions

What is Simpson's Paradox in simple terms?

It is a statistical trap where a trend appears in several groups of data, but disappears or reverses when those groups are summed. An option that seems better in each subgroup can turn out worse in the aggregated total, depending on how the data is distributed.

What is the most famous example of Simpson's Paradox?

The 1973 graduate admissions at the University of California, Berkeley. In total, 44% of men and only 35% of women were accepted, suggesting bias. Analyzing department by department, however, women had an equal or higher rate: they simply applied to more competitive areas.

What causes Simpson's Paradox?

The cause is a confounding variable (or lurking variable) distributed unequally across the groups. When this third variable influences both the subgroups and the outcome, the aggregated average weights the groups in a misleading way and masks the real trend.

How to avoid Simpson's Paradox in data analysis?

Never trust only aggregated averages. Segment the data by relevant variables, compare metrics per subgroup and in total, and visualize the relationships in charts. In Data Science, causal reasoning and domain understanding are essential to choose the correct level of analysis.

Does Simpson's Paradox only happen with categorical data?

No. Although the classic case involves rates and categories, the paradox also shows up in continuous data: a regression line can have a positive slope within each group and a negative one in the combined set. That is why segmentation matters for any type of data.

Topics in this article

## continue lendo

Keep browsing

About the author

Photo of Renata Weber

Renata Weber

Growth Specialist at Pareto Plus · Grupo Voitto

See profile and all articles