Simpson's Paradox Slider

Watch an aggregate trend reverse while both subgroup trends stay positive.

Working guidelines

0% Complete

Learning objectives

  1. Define Simpson's paradox as an aggregate relationship that reverses when a relevant subgroup variable is considered.
  2. Explain how uneven subgroup composition across the predictor can reverse an aggregate relationship even when the within-group relationships do not change.
  3. Recognize why the aggregate and subgroup analyses answer different questions.
  4. Use disaggregation in R to diagnose a Simpson's-paradox pattern in the UC Berkeley admissions data.

Step 1: Predict first

Imagine two subgroups. Within each subgroup, higher X is associated with higher Y. Now suppose the subgroup with generally higher Y becomes concentrated at the low end of X, while the subgroup with generally lower Y becomes concentrated at the high end.

1a. What do you predict will happen to the correlation if you ignore subgroup membership and pool everybody together?

1b. What do you predict will happen to the two within-group slopes?

Step 2: Start with the aggregate view

The slider changes how unevenly the two groups occupy the X-range. It does not change either group's internal relationship between X and Y.

0%
Grey points = everyone pooled; black line = pooled regression.
Pooled correlationr = +0.50
Pooled slopeb = +0.90
Group A slopehidden
Group B slopehidden
At 0% imbalance, both groups occupy the same X-range. Increase the slider slowly.

Step 3: Find the reversal

Keep the view on Aggregate only. Record the pooled relationship at the listed slider positions.

ImbalancePooled rPooled slopeDirection
0%
25%
50%
75%
100%

Q1. At approximately what imbalance did the aggregate line stop being positive and begin pointing downward?

Q2. Did any individual point suddenly switch from a positive to a negative within-group mechanism at the reversal? What actually changed?

Step 4: Reveal the groups

Set the slider to 100%, then click Reveal subgroups. Colored regression lines now show the relationship within Group A and Group B.

Q3. Compare the black pooled line with the two colored within-group lines. Describe the paradox without using the phrase “the statistics are wrong.”

Q4. The within-group slopes stay at about +0.90 throughout the slider. Why can the pooled slope become negative anyway?

Q5. Which variable is acting like the lurking variable here?

Step 5: Aggregate and subgroup answers are not interchangeable

The aggregate line answers: Across everybody, what happens to Y as X changes?

The colored lines answer: Among people in the same subgroup, what happens to Y as X changes?

Those are different questions. Simpson's paradox matters because researchers often intend one question and accidentally analyze the other.

Q6. Suppose Group A and Group B were two clinics with different patient severity. Give one research question for which the pooled answer might be useful and a different question for which the within-clinic answer would be more relevant.

Q7. Why is “always use the subgroup result” also too simple as a rule?

Step 6: Connect the mechanism to Berkeley in R

The book's real example uses UCBAdmissions, built into R. Run the code first. It computes the overall admission rates, then the admission rate within each department.

data(UCBAdmissions)

# Overall admission rates by gender
overall <- prop.table(
  margin.table(UCBAdmissions, c(1, 2)),
  2
)["Admitted", ]
round(overall, 3)

# Admission rates within each department
by_dept <- apply(
  UCBAdmissions,
  3,
  function(tab) prop.table(tab, 2)["Admitted", ]
)
round(by_dept, 3)

# How applicants were distributed across departments
margin.table(UCBAdmissions, c(3, 2))
Check your output — open this after you have run the code yourself.
Overall admitted:
  Male Female
 0.445  0.304

Within department:
             Dept
Gender        A     B     C     D     E     F
  Male      .621  .630  .369  .331  .277  .059
  Female    .824  .680  .341  .349  .239  .070

Applications by department (Male / Female):
A 825 / 108
B 560 / 25
C 325 / 593
D 417 / 375
E 191 / 393
F 373 / 341

Q8. In how many departments is the female admission rate equal to or higher than the male admission rate? How does that compare with the aggregate rates?

Q9. Which departments attracted disproportionately more female applicants, and how do their admission rates compare with Departments A and B?

Q10. Map the Berkeley example onto the simulator: what corresponds to X, Y, and the subgroup/lurking variable?

Step 7: Return to your prediction

Q11. Re-read your Step 1 predictions. What did you get right, and what part of the reversal was less intuitive than you expected?

Q12. Complete this sentence: “Before trusting an aggregate relationship, I should ask ___.”

Submission checklist

Filename: simpsons-paradox-slider_lastname1_lastname2.pdf