Work Causal safety

Anti-inflammatory painkillers looked barely riskier for your kidneys than paracetamol. They were twice as risky.

Python · Causal inference · Propensity scores · SCCS

1.19

Crude odds ratio

2.05

Propensity-score matched

2.14

Self-controlled case series

2.20

True effect, sealed in advance

The finding

Doctors were already steering the frailest patients away from them, which made the drug look safer than it was. Two independent methods recovered the real answer — 2.05 and 2.14, against a true value of 2.20 I had sealed before starting. The obvious comparison missed 46% of a real harm.

Method

New-user active-comparator design · propensity-score matching with covariate balance · self-controlled case series as an independent check · bootstrap intervals · negative-control outcome.

So what

When treatment is not randomly assigned, the gap between the crude number and the truth is not noise you can average away with more data. It is structural, it has a direction, and it usually flatters the drug.

Interactive

Switch between the crude, propensity-matched, and self-controlled estimates to see each odds ratio move toward the sealed true effect of 2.20.

RWE · CAUSAL ESTIMATE

Adjust, and the harm appears.

The crude comparison says these two drugs barely differ. But sicker patients were steered toward one of them — confounding. Switch on each method and watch the estimate climb toward the sealed truth.

ODDS RATIO
–
–
GAP TO TRUTH
–
true effect · OR 2.20
true · 2.20
OR 1.02.6

–

Full write-up

The question

Do NSAIDs cause acute kidney injury (AKI) compared with acetaminophen? Every project before this one asked is there a signal? This one asks the harder question — does the drug actually cause the harm? — which means confronting confounding head-on.

What I did

  • Design. A new-user, active-comparator emulation (NSAID vs acetaminophen), the standard pharmacoepidemiology guard against confounding by indication.
  • Propensity-score matching with a covariate-balance Love plot — the standard-mean-differences fell from ~0.14–0.27 to ~0.01, so the two groups became genuinely comparable.
  • A self-controlled case series (SCCS) as an independent cross-check — each patient is their own control, so it has different blind spots to the matched cohort.
  • Robustness: bootstrap confidence intervals, a window-sensitivity check, and a negative-control outcome (which correctly came back null).

Key finding

The estimates are in the interactive above. The naive, crude comparison gave an odds ratio of 1.19 — it understated a real harm by 46%, because channeling (sicker patients steered toward acetaminophen) hid it. Propensity-score matching moved that to 2.05, and the self-controlled series independently landed at 2.14. Both causal methods converged on roughly a doubling of AKI risk.

Why a sealed truth — and what this is not

This is a simulation study, and I want to be plain about that. The patient data is synthetic: I generated it with a known true odds ratio of 2.20 and kept that number sealed until the analysis was finished. So the finding here is not “NSAIDs cause AKI at OR 2.14” — that claim would need real claims or EHR data.

What it does demonstrate is the thing real data can never show you: whether your estimator recovers an effect you already know is there. Checking an estimator against a known answer is the standard way methods are validated, and it’s the point of the exercise — the crude estimate missed by nearly half, and both causal designs recovered the truth to within a few percent. The next step is the same protocol on real data (MIMIC-IV, credentialing in progress).