Compare overall and within groups
Tasks 5–6 · Simpson's paradox in course data
The Week 5 course registrations, drawn as a grouped chart in Week 6, show full time leading in both course groups while part time leads overall.
Lab 6 PDF p. 6 · Tasks 5–6 (24 minutes)
Your task
Compute within-group and pooled rates, reconstruct the pooled rates from weights, compare a common 50:50 mix, check EC102, and rewrite three claims about evidence.
Evidence to include
Rates 29.70%, 89.39%, 18.42%, 81.31%; pooled 74.46% and 77.02% (a 2.56-point gap); weights 0.25/0.75 and 0.068/0.932; common-mix 59.54% versus 49.87%; EC102 86.25% versus 88.24%.
Worked example and code
Try the task in the PDF first, then compare your working below. Run the code in your own Python notebook.
Open Lab 6 instructions (PDF)Tasks 5–6 · L6 p. 6.
1. Calculate each comparison
ft_pass = np.array([305, 2754])
ft_n = np.array([1027, 3081])
pt_pass = np.array([7, 422])
pt_n = np.array([38, 519])
ft_rates = ft_pass / ft_n
pt_rates = pt_pass / pt_n
print("FT within groups (%):", 100 * ft_rates)
print("PT within groups (%):", 100 * pt_rates)
ft_pooled = ft_pass.sum() / ft_n.sum()
pt_pooled = pt_pass.sum() / pt_n.sum()
print("Pooled FT, PT (%):", 100 * ft_pooled, 100 * pt_pooled)
print("PT minus FT (points):", 100 * (pt_pooled - ft_pooled))
| Group | Full time | Part time |
|---|---|---|
| Quantitative service | 305/1,027 = 29.70% | 7/38 = 18.42% |
| Other nine courses | 2,754/3,081 = 89.39% | 422/519 = 81.31% |
| All courses (pooled) | 3,059/4,108 = 74.46% | 429/557 = 77.02% |
Full time is higher within both groups; part time is higher overall by 77.02 − 74.46 ≈ 2.56 percentage points (computed from unrounded fractions). This reversal is Simpson's paradox.
2. Explain it with group sizes
ft_weights = ft_n / ft_n.sum()
pt_weights = pt_n / pt_n.sum()
print("FT group weights:", ft_weights) # [0.25 0.75]
print("PT group weights:", pt_weights) # [0.068 0.932]
print("FT reconstructed (%):", 100 * sum(ft_weights * ft_rates)) # 74.46
print("PT reconstructed (%):", 100 * sum(pt_weights * pt_rates)) # 77.02
ft_equal = 0.5 * ft_rates[0] + 0.5 * ft_rates[1]
pt_equal = 0.5 * pt_rates[0] + 0.5 * pt_rates[1]
print("Common 50:50 mix (%):", 100 * ft_equal, 100 * pt_equal) # 59.54, 49.87
Full-time weights are 1,027/4,108 = 0.25 and 3,081/4,108 = 0.75. Part-time weights are 38/557 ≈ 0.068 and 519/557 ≈ 0.932. Part time places about 93% of its weight on the "other" group, where pass rates are about 81–89%, while full time places 25% of its weight on the quantitative group, where rates are only about 18–30%. That difference in course mix lifts part time's pooled rate above full time's even though it is lower within each group.
With a common 50:50 mix, full time gives 59.54% and part time 49.87%: full time leads once composition is equalised. This is a calculated scenario, not an observed population.
EC102 exception: full time 207/240 = 86.25%; part time 30/34 = 88.24%. Part time leads in this course, so "full time leads in every individual course" is inaccurate. The broad groups hide course-level differences, and 34 is a small denominator.
Task 6: Say what the evidence supports
- "Part-time registrations had a higher overall pass rate (429/557 = 77.0%) than full-time registrations (3,059/4,108 = 74.5%). However, full time had the higher rate within both broad course groups, and the overall difference reflects part-time registrations being concentrated in higher-pass courses (93% versus 75%). These are observational records, so they do not show that part-time study causes better performance."
- Students who feel more ready may be more (or less) likely to join support, and readiness also affects passing, so readiness can confound the comparison. Even within one readiness group, motivation, available time, prior knowledge or the reason for joining can still differ between participants and non-participants.
- Feature selection is part of fitting the model, so it must use only training data; otherwise test information leaks into the choices. Keeping each student in one split stops the same person's registrations appearing in both training and test, which would make performance look better than it is for new students. The final test is used once, after all choices are fixed, so it remains an honest estimate.
Saved only in this browser. This note doesn’t fill in the downloaded notebook; “reviewed” is a personal checklist, not a grade.