Simpson's Paradox Generator
Simpson's paradox is the most useful uncomfortable fact in statistics: a comparison can point one way in every subgroup and the opposite way once the groups are pooled. Nothing is wrong with the arithmetic — the two sides simply handled different mixes of cases. This constructs a genuine example every time and verifies the reversal group by group before showing it.
What this generator does
Constructs two groups of cases with different difficulty and gives each side an opposite mix, so that one side does better in every group and worse overall. The reversal is then verified from the finished figures rather than assumed from the construction.
How to use this tool
- Generate a table.
- Read each group: B does better in both.
- Read the overall row: A does better.
- Look at the case counts — that is where the reversal comes from.
Understanding the controls
- Seed
- Reproduces exactly the same table, which matters when the figures are being used as a worked example someone else will follow.
Common use cases
- Demonstrating Simpson's paradox with fresh figures
- Teaching why aggregate comparisons need the case mix checked
- Explaining a confounding variable with a concrete table
- Producing worked examples for a statistics class
- Showing why a hospital with worse survival rates may be the better hospital
How this generator works
One side is given mostly straightforward cases and the other mostly difficult ones, with the second side doing better within each. Because the overall rate is the pooled figure rather than the average of the two rates, the side with the easier mix comes out ahead in total. Before display every rate is recomputed, the overall rates are confirmed to be pooled rather than averaged, and the reversal is checked — every subgroup must point one way and the total the other, or there is no paradox to show.
Randomness and fairness
Uses your browser's cryptographic random source to choose the figures, retrying until a genuine reversal is constructed. A seed switches to a reproducible sequence, deterministic and not cryptographically secure.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- The figures are constructed to reverse, so this demonstrates the paradox rather than testing whether real data shows it.
- Two subgroups only; real cases can involve several confounders at once and be far harder to see.
- Which comparison is the right one depends on the question being asked, and no amount of arithmetic settles that.
- The example is about rates; the same reversal can happen with averages and with regression slopes.
Privacy and your data
The figures are generated in your browser and nothing is transmitted, stored or included in analytics.
Related generators
- A/B Test Significance CalculatorRuns a two-proportion test on your conversion counts and is plain about what the p-value does and does not mean.
- Statistical Power CalculatorWorks out the chance a test would detect a real effect of a given size, and how many people it would take to reach the usual eighty per cent.
- Correlation Matrix GeneratorCorrelation matrices built from a factor model, so they are positive semi-definite — which hand-picked numbers usually are not.
- Confidence Interval CalculatorTurn a count out of a sample into an interval, with a warning when the sample is too small for the usual approximation to be trusted.