Recovery at two hospitals (Simpson's paradox)
Patient-level outcomes for 1 000 patients treated for the same condition at two fictional hospitals (Hospital A, a regional referral centre, and Hospital B, a community hospital). Each row is one patient with hospital, severity on admission, age, length of stay and whether they recovered. Hospital A has the higher recovery rate within both mild and severe cases yet the lower rate overall, because it receives most of the severe cases — Simpson's paradox. The aggregated counts are in hospital_outcomes_summary.
- Rows
- 1,000
- Columns
- 6
- One row is
- one patient admission
- Version
- v1
Data dictionary
| Column | Type | Unit | Summary | Description |
|---|---|---|---|---|
patient_idPatient | id | Anonymous patient code. | ||
hospitalHospital | category | 2 levels: Hospital A, Hospital B | Treating hospital (fictional). | |
severitySeverity | ordinal | 2 levels: mild, severe | Severity on admission. | |
ageAge | integer | years | mean 57.16, median 58, SD 15.37, range 18–95 | Age on admission. |
length_of_stay_daysLength of stay | integer | days | mean 6.615, median 5, SD 5.917, range 1–41 | Days in hospital. |
recoveredRecovered | boolean | 2 levels | True if the patient recovered by 30 days after admission. |
What it is good for
- Compute recovery rates overall and by severity and observe the reversal (Simpson's paradox).
- Explain the reversal through the different case mix (severity is a confounder).
- Compute a severity-standardised (adjusted) recovery rate for each hospital.
- Discuss which comparison answers the question 'where should I be treated?'.
Methods: contingency tables, conditional proportions, stratification, direct standardisation, Mantel–Haenszel, logistic regression.
Data quality notes
- Constructed teaching data: exact cell counts guarantee the paradox (A better within each severity, worse overall).
- Fictional hospitals and patients; no missing values.
Provenance and licence
The counts in each hospital × severity × outcome cell are fixed exactly (A mild 95/100, A severe 300/400, B mild 360/400, B severe 70/100). Age and length of stay are simulated: severe patients are older (mean ≈66 vs ≈48) and stay longer (gamma, mean ≈9 vs ≈3 days); non-recovered patients stay longer. Row order is shuffled.
Synthetic data · CC0-1.0 (synthetic data generated by Statistics Quest) · generated deterministically (seed 20241021). It does not describe real people or organisations; any resemblance is coincidental.
Preview
Dataset
Recovery at two hospitals (Simpson's paradox)
1,000 rows · one row = one patient admission · synthetic data
| Patient | Hospital | Severity | Age (years) | Length of stay (days) | Recovered |
|---|---|---|---|---|---|
| PT0001 | Hospital B | mild | 54 | 5 | true |
| PT0002 | Hospital A | severe | 77 | 8 | true |
| PT0003 | Hospital B | mild | 61 | 5 | true |
| PT0004 | Hospital B | mild | 50 | 3 | true |
| PT0005 | Hospital A | mild | 38 | 7 | true |
| PT0006 | Hospital B | severe | 42 | 6 | true |
| PT0007 | Hospital A | severe | 57 | 13 | false |
| PT0008 | Hospital A | severe | 78 | 7 | true |
| PT0009 | Hospital A | mild | 40 | 1 | true |
| PT0010 | Hospital A | severe | 78 | 9 | true |
| PT0011 | Hospital B | mild | 69 | 1 | false |
| PT0012 | Hospital A | severe | 84 | 12 | true |
Used in
- Contingency tables · Comparing Groups and Categorical Data
- Chi-square test of independence · Comparing Groups and Categorical Data
- Choosing a test · Comparing Groups and Categorical Data
- Simpson's paradox · Resampling and Statistical Reasoning
- Rates and proportions in public health · Applied Statistics for Professionals