CS350 · Fallacies · Simpson’s paradox
This is a real-life example from a medical study comparing the success rates of two treatments for kidney stones. Treatment A is a more invasive procedure than Treatment B.
The numbers in parentheses are the successful cases over the total size of the group.
| Treatment A | Treatment B | |
|---|---|---|
| All patients | 78% (273 / 350) | 83% (289 / 350) |
From these numbers alone, which treatment looks more effective? Agree on an answer as a group.
Two or three sentences.
However, when we look more closely by stone size, we see the following:
| Treatment A | Treatment B | |
|---|---|---|
| Small stones | 93% (81 / 87) | 87% (234 / 270) |
| Large stones | 73% (192 / 263) | 69% (55 / 80) |
| Both | 78% (273 / 350) | 83% (289 / 350) |
Each treatment’s success rate within a stone size stays fixed. The only thing you change is how many of its patients had large stones.
Despite Treatment A performing better for both small and large stones individually, its overall success rate is lower. This is a real-world illustration of what is known as Simpson’s Paradox—a topic we will return to later in this MA program.
On the chart, A’s line sits above B’s at every mix. A only looks worse overall because it was given far more of the hard cases: 75% of A’s patients had large stones, against 23% of B’s. Stone size is a lurking (confounding) variable: it affects both which treatment a patient got and how likely the treatment was to succeed.
One box per step. Answer as a group; be ready to share.
Part 1: Clarifying the Argument (Identification)
Part 2: Analyzing for Fallacies
Part 3: Correcting the Fallacy
The code cell below loads the data from this real-world study. Run it first; the exercises after it use kidney.
Before you run anything: should Treatment A’s overall rate be closer to its small-stone rate or its large-stone rate? Then compute each treatment’s overall success rate from the counts (not from the rounded success_rate column), as a proportion.
kidney$treatment == "A" picks out A’s rows.sum(kidney$successes[kidney$treatment == "A"]) is A’s total successes; divide by the same sum of total.Compute the share of each treatment’s patients who had large stones. Compare with the slider’s starting positions.
&: treatment and stone size.kidney$total[kidney$treatment == "A" & kidney$stone_size == "Large"], divided by A’s total patients.Give both treatments the same mix of stones: the mix of all 700 patients together. Compute that mix, then each treatment’s success rate at that mix (its small-stone rate weighted by the small share, plus its large-stone rate weighted by the large share). Your answers should match what the chart shows when you press Give both the same mix.
kidney$successes / kidney$total gives the four exact rates in row order: A small, A large, B small, B large.r <- kidney$successes / kidney$total, A’s adjusted rate is r[1] * (1 - mix) + r[2] * mix.Is there any kind of analysis and/or data visualization that you think would be helpful or interesting? If so, attempt it, and feel free to ask your professor and/or AI for advice. You can even, for example, ask AI for advice on what analysis would be relevant and/or interesting, if you want some help getting started.
Data: Charig, C. R., Webb, D. R., Payne, S. R., & Wickham, J. E. A. (1986). Comparison of treatment of renal calculi by open surgery, percutaneous nephrolithotomy, and extracorporeal shockwave lithotripsy. BMJ, 292, 879–882. Steps 1–7 follow Flora, T., Koloskov, N., Stan, T., & Terrana, A. (2021). Fallacies Applications, Document 1: Fallacies Analysis Framework and Excerpts (v2) [Course resource, CS50 Formal Analyses]. Minerva.