Treatment X, recovery Y and a third variable Z are all binary. The overall recovery rate of an arm is an average of its two group rates, weighted by how that arm is made up: P(Y = 1 | X = x) = Σz P(Y = 1 | x, z) P(z | x). If the arms are made up differently, the pooled comparison can reverse the comparison within every group. Panel (a) shows each arm's rate as a point on the segment joining its two group rates; the squares use the same mix P(z) for both arms, which is the adjusted comparison (16.7). Whether the pooled or the adjusted comparison is the causal one is not in the table: it depends on whether Z comes before the treatment or is caused by it.
The white dots in panel (c) come from one sample of the chosen size drawn from the table with the seeded generator; with small samples even the within-group comparisons can flip by chance.
code/ch16_causal_inference.py (simpson_table, simpson_summary, simpson_sample; Figure 16.S3).