Statistics Quest

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

ColumnTypeUnitSummaryDescription
patient_id
Patient
idAnonymous patient code.
hospital
Hospital
category2 levels: Hospital A, Hospital BTreating hospital (fictional).
severity
Severity
ordinal2 levels: mild, severeSeverity on admission.
age
Age
integeryearsmean 57.16, median 58, SD 15.37, range 18–95Age on admission.
length_of_stay_days
Length of stay
integerdaysmean 6.615, median 5, SD 5.917, range 1–41Days in hospital.
recovered
Recovered
boolean2 levelsTrue 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

PatientHospitalSeverityAge (years)Length of stay (days)Recovered
PT0001Hospital Bmild545true
PT0002Hospital Asevere778true
PT0003Hospital Bmild615true
PT0004Hospital Bmild503true
PT0005Hospital Amild387true
PT0006Hospital Bsevere426true
PT0007Hospital Asevere5713false
PT0008Hospital Asevere787true
PT0009Hospital Amild401true
PT0010Hospital Asevere789true
PT0011Hospital Bmild691false
PT0012Hospital Asevere8412true

Used in