Causal Survival Analysis

Python · lifelines, from scratch  ·  R · survRM2, ipw  ·  simulated trial, 4,000 patients, known counterfactuals

The Number Everybody Reports

Time-to-event outcomes break the arc's usual machinery in a way that has nothing to do with confounding. Some subjects have not had the event when the study ends, so their outcome is censored — known only to exceed some value. Every estimator in this arc so far assumed an outcome you could subtract.

The field's default answer is the Cox hazard ratio, and on a simulation of 4,000 patients where the truth is known it reports 0.60. The true hazard ratio is not a number at all. It runs from 0.139 early, when the treatment benefit is large, to 0.750 late, when the benefit has nearly gone.

hazard ratiovaluewhat it is
unadjusted Cox0.601the number usually reported
Cox with the confounder0.352confounding removed
the truth0.139 → 0.750not a constant at all

That single figure has two separate things wrong with it, and they are worth separating because only one is fixable by adjustment. The 0.60 is unadjusted: treated patients in this design were sicker, so the raw comparison understates the benefit. Putting the confounder into the same Cox model gives 0.352, so confounding accounts for 0.249 of the distance — and adjustment fixes that part completely.

What adjustment does not touch is the rest. The adjusted 0.35 is a perfectly respectable confounding-free number, and it is still a single constant standing in for something that runs from 0.14 to 0.75. It lands somewhere inside that range with nothing to say about where, and no diagnostic on the adjusted model reveals the problem — because the problem is not bias in the usual sense. The estimand itself is a summary of a curve that changed shape. This is Hernán's hazards of hazard ratios, and it is why the rest of the page estimates something else.

An Estimand That Survives Contact With the Data

The replacement is restricted mean survival time: average survival up to a horizon, which is a number of years, is collapsible, and means the same thing whether or not the hazards are proportional. On this data the true RMST difference is 1.62 years, and two independent routes recover it:

estimateRMST difference (years)route
naive Kaplan–Meier0.97confounded — the treated were sicker
IPTW1.69models treatment
g-computation1.57models the outcome
truth1.62known from the simulation

Inverse-probability weighting reweights the sample into a pseudo-population where treatment is unconfounded, then compares Kaplan–Meier curves. G-computation goes the other way — fit an outcome model, predict every patient's survival under both arms, and average. They come at the problem from opposite ends, one modelling treatment and the other modelling the outcome, and they land within 0.12 years of each other on a true effect of 1.62. That agreement is the check; either alone would be an assertion.

The naive Kaplan–Meier comparison gives 0.97 — understating a real benefit by 40% — because the treated arm was sicker to begin with. Same direction of error as the unadjusted hazard ratio, same cause, and here it is measured in years rather than in a ratio nobody can interpret.

The survival-probability contrast at a fixed horizon behaves the same way: IPTW gives +0.323 against a true +0.317. Both RMST and survival differences are interpretable and collapsible; the hazard ratio is neither, which is the whole argument for reporting them instead.

Where this sits

The IPTW construction here is the same reweighting as propensity weighting, applied to a censored outcome, and the g-computation route is the outcome-modelling half of doubly-robust estimation. The likelihoods themselves — Weibull, Cox-via-Poisson, frailty models — are the survival catalogue, now asked a causal question. And when treatment is given repeatedly and the confounders respond to it, weighting has to be applied at every time point: that is marginal structural models.

Notebooks

Downloads

References