Benchmarking RWE Against an RCT: Which Study Design and Analysis Choices Move the Estimate
Nikhil Tiwari
Given the same database and the same question, five capable teams will return five numbers. When 29 teams analysed one dataset to answer one question, their odds ratios ran from 0.89 to 2.93 (Silberzahn et al., 2018). Each number comes with a confidence interval, a methods section and a sound-looking rationale. Usually no one can say which is right, because the true effect is unknown. This post works through a case where a randomized trial has already answered the question, so every decision in the analysis can be benchmarked against it.
TL;DR. A randomized trial with a known answer (albumin does not change mortality in sepsis) was emulated in hospital records, and one analytic choice was changed at a time. The raw records showed about seven fewer deaths per hundred patients with albumin. If the trial is right, almost all of that was bias. Here is what each change did.
- Time zero and the treatment window. Widening the window in which a patient could count as treated, from 6 to 72 hours, moved the random-forest estimate steadily toward a benefit. With a wider window, treatment can depend on how a patient did in the first hours of follow-up, which opens the door to immortal time bias. A wider window also changes who enters the cohort. What to check: that follow-up starts at the same moment in both arms, and that the estimate holds with a shorter and a longer window.
- Confounders. Dropping the severity measures (labs, vitals, severity scores) moved the estimate about a quarter of the way back toward the false benefit, and keeping socio-demographics alone moved it halfway. Dropping the drug variables barely changed it. What to check: that the confounder list is drawn from a causal graph and holds nothing measured after treatment.
- The models inside the estimator. The same estimator, which combines a model of who gets albumin with a model of who dies, showed a large benefit with linear models and no effect with random forests. That was the biggest swing in the study. What to check: that the models were chosen by how well they predict patients they were not trained on, under a rule fixed in the analysis plan before any estimate is seen. Chosen this way, by a super learner, the estimate was −0.17 pp against the trial's −0.16 pp, though the trial's ±4.3 pp interval cannot rank it above random forests alone.
The question happens to be clinical, but the lessons are about the decisions an RWE or HEOR (health economics and outcomes research) lead signs off on: the protocol, the confounder list, the estimator, and the sensitivity analyses a regulator, health technology assessment (HTA) body or payer will ask for. Each section below covers one decision. It opens with how far that decision moved the estimate, explains how it can bias the answer, with the intuition before the maths, and closes with the questions to put to the study team. Readers who sign off on studies can follow the headings and those closing boxes; the five questions are collected in Table 9.
The study this post builds on
Doutreligne and colleagues, at Inria and MIT, wrote a step-by-step guide to causal analysis of electronic health records and tested it on a question with a known trial answer. They emulated ALBIOS, a randomized trial of albumin in sepsis, in MIMIC-IV, a public database of intensive care records. They varied the study design, the confounder set, the estimator and the models inside it one step at a time, and published their code with every estimate. Their central finding is that every step matters about equally. Putting every step on one scale, this post finds one step that matters more than the rest.
This post starts from that study, extends it and examines each step in depth. Frekil reproduced the analysis from the published code: the same 18,421 adults with sepsis, the same 28-day deaths, and fresh estimates within 0.19 percentage points of the published ones. Three extensions are new here: who actually receives albumin in this hospital, a super learner that chooses the models inside the estimator by prediction accuracy alone, and every analytic choice on one scale. The estimates for the treatment windows, confounder sets, feature summaries, estimators and the linear and forest models come from that study's published results, and all figures are redrawn from them.
The vocabulary, one line each
| Term | What it means here |
|---|---|
| Risk difference (RD), pp | 28-day mortality with albumin minus mortality without it, in percentage points (pp). −1 pp means one fewer death per hundred patients treated; negative numbers favour albumin. |
| Crude difference | The RD with no adjustment at all: treated against untreated mortality as recorded. |
| Time zero | The moment follow-up starts. In a trial it is randomization; in records, someone has to choose it. |
| Treatment window | The hours after time zero within which albumin must start for a patient to count as treated: 24 h in the main analysis, 6 and 72 h as alternatives. |
| Confounder | A variable that drives both who gets treated and who dies, such as illness severity. |
| Feature summary | How a measurement taken many times before time zero, such as lactate, is reduced to one value per patient: first, last, median, or a combination. |
| Propensity score | A patient's probability of receiving albumin, given their confounders. |
| Overlap (positivity) | Every kind of patient had some real chance of either treatment, so propensity scores stay away from 0 and 1. |
| Estimator | The recipe that turns adjusted data into one number: matching, weighting, outcome modelling, or a doubly robust mix of the last two. |
| IPW | Inverse propensity weighting: reweights patients by their propensity score so the two arms look alike. |
| Doubly robust, AIPW | An estimator that is right if either the propensity model or the outcome model is right. AIPW (augmented IPW) is the one used throughout this post. |
| Nuisance models | The models fitted inside the estimator (the propensity model and the outcome model). Nobody reports them, but the answer depends on them. |
| Super learner | A method that combines several candidate models, weighted by how well each predicts patients it was not trained on. |
| Vibration analysis | Rerunning the study under every reasonable alternative choice and reporting how far the answer moves. |
The short version: the models inside the estimator moved the answer most
Before the details, here is the whole story in two charts. Figure 1 shows how far each decision moved the estimate: the spread, the highest minus the lowest estimate across that decision's options, with everything else held fixed. Spreads are in percentage points of the 28-day risk difference.
Figure 1. How far each analytic choice moved the estimate. The models inside the estimator moved it 8.45 pp; each design choice moved it 1.55 to 3.06 pp. Spread across the options shown in Figure 2, AIPW with random forests unless stated. The estimator spread leaves out propensity score matching, which failed outright at +67.30 pp (Decision 3).
Figure 2 shows every option behind those bars. Negative numbers favour albumin, and the trial puts the true value near zero. Each heading in the figure names one analytic choice, with everything else held fixed, and the rows under it are its options: each with its estimate, its 95% confidence interval and the value on the right. The grey spread beside each heading is the highest minus the lowest of those estimates. All rows use the doubly robust AIPW estimator with random forests inside it, except where the estimator or the model class is the thing being varied. The trial sits at the top for reference, and the dashed line marks no effect.
Figure 2. Every option of every analytic choice, 28-day risk difference, AIPW with random forests unless stated. Super-learner rows are from this analysis (Decision 4); all other rows are published estimates. The 24 h, all-confounders and first + last rows share one specification but come from separate runs, which is why they read −0.38, −0.28 and −0.03; compare rows under the same heading, not across headings.
Four things to take from them:
- The design choices each moved the answer by about 3 pp. With random forests inside the estimator, the treatment window, the confounder set and the choice among IPW, outcome model, DML and AIPW each moved it by 2.8 to 3.1 pp. A gross error at any step breaks the estimate, and plausible choices at every step produce biases of the same order.
- The biggest lever is the least visible one. Switching the models inside one estimator from linear to random forests moved the answer by 8.45 pp, more than any design choice. That decision often lives in a code repository, not in the protocol.
- How each patient's history is summarized mattered least. The five feature summaries moved the answer by 1.55 pp, about half as much as the other design choices.
- A misfit model exaggerates every other choice. With linear models inside the estimator, each design choice moved the answer one and a half to two and a half times as far (Table 7). Fix the models inside the estimator first, then vary the rest.
After the benchmark, the rest of the post walks through the analytic choices of Figure 2 in the order a study team makes the decisions.
The benchmark: an RCT that already answered the question
The data are MIMIC-IV, the public intensive care database of Beth Israel Deaconess Medical Center in Boston. The question is whether giving albumin on top of crystalloid fluids (salt solutions such as saline) in sepsis changes 28-day mortality. The benchmark trial is ALBIOS, a randomized trial in 100 Italian ICUs: 285 of 895 patients given albumin (31.8%) and 288 of 900 given crystalloids alone (32.0%) died by day 28 (Caironi et al., NEJM 2014). A meta-analysis of trials agrees, with an odds ratio of 0.93 (95% CI 0.80 to 1.08) (Xu et al., Critical Care 2014). Neither finds a difference in mortality.
That makes it a benchmark in the strict sense. When an analysis of the hospital records reports a benefit, its error can be measured against the trial, within the trial's own uncertainty.
The emulation cohort is 18,421 adults with sepsis on their first ICU stay. Follow-up starts at the first crystalloid, and a patient counts as treated if albumin starts within the next 24 hours. This is the "24 h cohort" of the main analysis; Decision 1 varies the window.
Table 1. The benchmark trial and the raw records. Deaths by arm in ALBIOS (Caironi et al., NEJM 2014) and in the MIMIC-IV 24 h cohort (Doutreligne et al., 2024). The ALBIOS interval uses a Wald standard error from these counts.
| ALBIOS, albumin | ALBIOS, crystalloids | MIMIC-IV, albumin | MIMIC-IV, crystalloids | |
|---|---|---|---|---|
| Patients analysed at day 28 | 895 | 900 | 3,559 | 14,862 |
| Deaths by day 28 | 285 (31.8%) | 288 (32.0%) | 449 (12.6%) | 2,913 (19.6%) |
| Deaths by day 90 | 365/888 (41.1%) | 389/893 (43.6%) | 592 (16.6%) | 3,859 (26.0%) |
| Risk difference, day 28 | −0.16 pp (−4.47 to 4.16) | −6.98 pp (crude) | ||
The crude comparison says albumin saves one patient in every fourteen treated, an effect no trial has found. The MIMIC-IV control arm died far less often than the ALBIOS control arm (19.6% against 32.0%). The hospital population was less ill than the trial's, a point that returns in the limitations.
Where the false benefit comes from: albumin goes to patients who rarely die
Start with what the crude −6.98 pp actually measures. If albumin does nothing, as the trials say, all of it is bias: the albumin patients were people who would have died less often anyway. The question to ask is how the albumin patients would have done without albumin, compared with the patients who never got it.
Who gets albumin
The answer starts with where albumin is given. Table 2 tabulates albumin use by first ICU unit in the 24 h cohort. Use varied more than twentyfold. In the cardiac vascular ICU, mostly patients recovering from cardiac surgery, 52.5% received albumin and only 3.5% died by day 28. In the medical ICU, 7.6% received it and 25.6% died. About two-thirds of all albumin-treated patients were in the cardiac unit.
Table 2. Albumin use and 28-day mortality by first ICU unit, 24 h cohort. The three neurological units are combined.
| First ICU unit | Patients | Given albumin, % | Died by day 28, % |
|---|---|---|---|
| Cardiac vascular ICU (CVICU) | 4,393 | 52.5 | 3.5 |
| Medical ICU (MICU) | 3,895 | 7.6 | 25.6 |
| Medical/surgical ICU (MICU/SICU) | 3,403 | 4.0 | 25.2 |
| Surgical ICU (SICU) | 2,532 | 14.5 | 18.0 |
| Trauma surgical ICU (TSICU) | 2,055 | 19.9 | 17.0 |
| Coronary care unit (CCU) | 1,480 | 2.4 | 26.8 |
| Neurological units (Neuro SICU, intermediate, stepdown) | 663 | 1.7 | 22.8 |
This is confounding by indication in plain view. Albumin is mostly a cardiac-surgery drug in this hospital, and cardiac-surgery patients rarely die. A crude comparison credits albumin with the low mortality of the unit where it is used. Use also changed over time: 13.1% of patients in 2008 to 2010 (n = 6,047), 23.2% in 2011 to 2013 (4,667), 24.7% in 2014 to 2016 (4,586) and 17.7% in 2017 to 2019 (3,121).
Two consequences carry through the rest of the post. ICU unit and calendar period are not among the 24 confounders the analysis adjusts for (listed under Decision 2). Severity scores must therefore absorb the whole difference between cardiac-surgery and medical patients, and any residual unit effect biases toward benefit. And in the coronary care and neurological units albumin is almost never given, so those patients have almost no treated counterparts to be compared with. That is a failure of overlap, also called positivity. Neither adjustment for unit nor overlap within units was tested here. For a study lead, the general point is that a tabulation of treatment by site, unit and period before any modelling is cheap, and it shows where confounding and poor overlap are likely to come from.
The bias, written out
Causal inference writes the question with potential outcomes. Each patient has an outcome Y(1) if given albumin and Y(0) if not, and the records show only the one that happened.
Here A = 1 if albumin is given, Y = 1 if the patient dies within 28 days, and τ is the average treatment effect: mortality if everyone got albumin minus mortality if no one did. The first line, which says the recorded outcome is the potential outcome under the treatment actually received, is called consistency. A trial estimates τ by randomizing A. Records do not randomize, so the crude comparison splits into two pieces:
The bias term is that question in symbols: how the albumin patients would have done without albumin, against the patients who never got it. If albumin does nothing, the whole −6.98 pp is that term. Every step that follows is an attempt to drive it to zero.
Why a better prediction model does not fix this
Consider a failure that tempts any team with good machine-learning tools. A gradient-boosting model was trained to predict 28-day mortality from the last measurements of the first 24 hours in the ICU. On held-out patients its area under the precision-recall curve was about 0.50, against 0.18 for a random classifier. When tested on only the measurements available before the first crystalloid (the emulation's time zero), it fell by about 10 points, to about 0.40 (Doutreligne et al., 2024). It had learned from information recorded after treatment began: shortcuts a prediction model can exploit that carry no causal information. A model can predict mortality very well and still be unable to say what albumin does, because prediction never has to separate the bias term from the effect.
Decision 1. Time zero: wider treatment windows drift toward benefit
In short. Widening the window from 6 to 24 to 72 hours moved AIPW with random forests from +1.01 to −0.38 to −1.87 pp, toward a benefit the trial never found. Classifying treatment by what happens after time zero opens the door to immortal time bias, and each window also changes who enters the cohort.
The first defence against bias is to write down the randomized trial one would ideally run, then emulate it as closely as the data allow (Hernán and Robins, 2016). NICE's real-world evidence framework makes this its first design recommendation: "Design studies to emulate the preferred randomised controlled trial (target trial approach)" (NICE RWE framework). Table 3 puts the emulation beside ALBIOS.
Table 3. Target trial specification: ALBIOS and the observational emulation in MIMIC-IV.
| Element | Target trial (ALBIOS, Caironi et al., 2014) | Emulation in MIMIC-IV |
|---|---|---|
| Eligibility | Adults meeting criteria for severe sepsis within the previous 24 h in the ICU; 100 Italian ICUs, August 2008 to February 2012 | First ICU stay, age 18 or over, Sepsis-3; ICU stay and survival of at least the window; first crystalloid within the window of ICU admission; one US centre, 2008 to 2019 |
| Treatment strategies | 20% albumin plus crystalloids, targeting serum albumin of 30 g/L or more until ICU discharge or day 28, versus crystalloids alone | Any albumin within the window (24 h in the main analysis), after the first crystalloid, versus crystalloids only |
| Assignment | Central randomization, stratified by ICU and time from sepsis criteria; open label | Observed; exchangeability assumed given 24 confounders chosen from an expert causal graph |
| Time zero | Randomization | First crystalloid administration, in both arms |
| Outcome | Death from any cause at 28 days (primary) and 90 days | Death within 28 days of time zero |
| Estimand | Intention-to-treat effect of the strategy | Average treatment effect of early albumin, as a risk difference |
| Analysis | Chi-square test, intention to treat | Matching, IPW, outcome model, AIPW and double machine learning; bootstrap confidence intervals |
Writing the table already exposes a gap: ALBIOS tested sustained albumin to a serum target, while the emulation contrasts any albumin in the first 24 hours. That is a different treatment strategy, and a reviewer will see it. The table also forces the team to say how treatment and outcome are found in the records, which matters because recording can depend on treatment. One example: albumin is costly, so a treated stay is more likely to carry a sepsis billing code, while among crystalloid-only stays only the severe ones may be coded.
The mechanism: survival for free
In a trial, eligibility, assignment and the start of follow-up all happen at randomization. In records they can drift apart, and the gap creates bias. Suppose follow-up starts at ICU admission and a patient counts as treated if albumin is given at any point in the next 24 hours. To be counted as treated at hour 20, a patient has to be alive at hour 20. Those 20 hours are "immortal" for the treated arm. A patient who dies at hour 5 can only ever be counted as untreated.
In symbols, with D the time of death, TA the time of first albumin and w the window, the risk measured in the treated arm is conditional on surviving until treatment:
The condition D > TA removes early deaths from the treated arm only, so the drug looks protective even if it does nothing. The wider the window, the more free survival the treated arm gets. NICE names the remedy in its framework: "Avoid time-related biases due to differences between patient eligibility criteria being met, treatment assignment, and start of follow up" (NICE RWE framework). ICH M14 describes the same mechanism as person-time handled differently between arms "through either misclassification or exclusion" (ICH M14). The standard fix is to start follow-up at the same moment in both arms, which a target trial forces the team to write down (Hernán et al., 2016).
The emulation sets time zero at the first crystalloid in both arms and measures confounders before it. Albumin can still start later within the window, but the gap is short: a median of 6.7 hours (interquartile range 8.7 hours) against a median of 40 days to death. The cohort also requires every patient, treated or not, to stay in the ICU for the whole window. That removes the classic form of the bias: a patient who dies at hour 5 now leaves the study, instead of being counted as untreated. Two things remain. Treatment is still decided by what happens after time zero, so how a patient fares in the first hours can shape both whether they get albumin and whether they die. And because of the survival rule, the window decides who enters the study.
What the window did: each wider window favoured albumin more
To test this, the analysis was rerun with 6, 24 and 72 hour windows (Figure 3). Even the crude difference, with no model at all, changed: −0.46 pp at 6 h, −6.98 pp at 24 h and −4.82 pp at 72 h. Each window is a different cohort with a different case mix. With random forests, AIPW (explained under Decision 3) went from +1.01 to −0.38 to −1.87 pp, and IPW from −2.49 to −2.89 to −4.08 pp. Both drift toward benefit as the window widens. Read as immortal time bias, this makes albumin look more effective the longer the window (Doutreligne et al., 2024). With every patient required to stay in the ICU through the window, part of the drift may instead be the change in who enters the cohort, and these runs cannot separate the two. Linear AIPW did not follow the pattern (−2.97, −8.56 and −6.36 pp), an early sign that the model class matters as much as the design.
Figure 3. Estimates by treatment window. Each window defines a different cohort. 30 bootstrap replicates.
The window is part of the question. When treatment can start at any time within it, the design-based fix is clone-censor-weighting. Each patient is copied into both arms at time zero, each copy is censored when it departs from its arm's strategy, and the analysis weights for that censoring (Hernán et al., 2016). A version with baseline-only censoring weights was tried here and is not reported, because its diagnostics failed (see Limitations).
Decision 2. Confounders: the severity measures carry the adjustment
In short. With all 24 confounders the estimate was −0.28 pp. Dropping the severity measures gave −2.11 pp, and socio-demographics alone gave −3.34 pp, against a crude −6.98 pp. Dropping the drug variables changed it by only 0.3 pp.
Identification asks what must be true for the adjusted comparison to equal the causal effect. Two assumptions carry most of the weight. Conditional exchangeability says that among patients with the same measured confounders X, treatment is as good as random. Positivity, or overlap, says that every kind of patient had some real chance of either treatment. (Two more are needed: consistency, defined above, and that the population the models learn from is the one the effect is computed for.) Under the first two, the effect can be computed from observed data in two equivalent ways:
μa(X) is the mortality of patients like X under treatment a, and e(X) is the propensity score. η is a small margin that keeps every propensity away from 0 and 1, which is overlap written as a condition. These two expressions are the two routes every estimator under Decision 3 takes: model the outcome, or model who gets treated. Rosenbaum and Rubin showed that adjusting for the propensity score alone is enough when exchangeability holds given X.
Only overlap can be checked in the data. Exchangeability rests on knowing why patients were treated, and it pulls against overlap: adding variables makes exchangeability more plausible, but variables that predict treatment and nothing else push propensity scores toward 0 or 1.
Every variable has a role
Whether a variable belongs in the model depends on its causal role. A confounder causes both treatment and outcome, and adjusting for it removes bias. A mediator sits on the path from treatment to outcome, and adjusting for it removes part of the effect being estimated. A collider is caused by both, and adjusting for it creates an association that was not there. An instrument affects treatment only, so adjusting for it adds no protection and erodes overlap. An effect modifier changes the size of the effect and is what subgroup analyses look for.
The working rule: adjust for confounders and for nothing measured after treatment. The prediction model above failed because it had, in effect, adjusted for post-treatment information. The analysis takes 24 confounders from an expert causal graph: demographics and insurance, emergency admission, comorbidities, antibiotics, vasopressors, ventilation, renal replacement therapy, vital signs, lactate, urine output, weight, AKI stage, SOFA and SAPS II. NICE asks for the same discipline: "Identify potential confounders (including time-varying confounders) using a systematic approach and clearly articulate causal assumptions" (NICE RWE framework). Even a careful list has timing traps. The first-day SOFA score, for example, might be a collider, because it can include values recorded after albumin.
Which omissions hurt: unbalanced times prognostic
The albumin patients were sicker on several measures (mean SOFA 6.9 against 5.7, lactate 3.7 against 2.8, vasopressors 80.2% against 41.7%, ventilation 96.8% against 87.0%), yet fewer were emergency admissions (30.7% against 57.3%) and they died less often (Doutreligne et al., 2024). Which of these differences bias the estimate? Only those that are both unbalanced between arms and related to death. For a linear outcome model, leaving out a confounder U adds roughly:
The product is the useful intuition. A variable that is badly unbalanced but unrelated to death does no harm when omitted, and neither does a strong predictor of death that is equally common in both arms. Formal sensitivity analysis for unmeasured confounding asks how large γ and δ would have to be to explain the estimate away (Cinelli and Hazlett, 2020).
What leaving confounders out did: severity mattered, drugs barely did
Sets of confounders were then dropped in turn (Figure 4). With AIPW and random forests, all 24 confounders gave −0.28 pp. Removing the drug variables (four antibiotic classes and vasopressors) gave −0.58 pp, a change of only 0.3 pp. Removing the 11 severity measurements (labs, vitals, weight, urine output, AKI stage, SOFA and SAPS II) gave −2.11 pp. Socio-demographics alone gave −3.34 pp, about halfway back to the crude −6.98 pp. Severity is both unbalanced and prognostic, so for those variables γ and δ are both large, and dropping them hurts most.
Figure 4. Estimates by confounder set, 24 h window.
With linear models, the ordering broke down. Dropping the drug variables moved linear AIPW from −7.88 to −10.02 pp, and dropping the measurements moved it to −2.26 pp, closer to the trial than the full set. A confounder set cannot be judged apart from the model that uses it. With a poorly fitting model, removing variables can move the estimate toward the truth for the wrong reason, and a reviewer who sees only the final number cannot tell.
A smaller lever: how each patient's history becomes one row
Heart rate or lactate is measured many times before time zero, and most estimators need one row per patient. The analysis tries the first value, the last value, the median, first and last together, and all three. Richer summaries can tell a deteriorating patient from a stable one, which reduces confounding. But every extra column the treatment model can use pushes some propensities toward 0 or 1, eroding overlap. Overlap is measured with the normalized total variation (NTV) of the fitted propensities:
Ā is the share of patients treated. If the propensities carry no information, every term is zero; the better the model can tell the arms apart, the larger the NTV.
Table 4. Overlap (NTV) and AIPW estimate by feature summary, 24 h window, all confounders. First + last from the main run, the others from a separate feature-summary run.
| Feature summary | NTV, forests | AIPW RD, forests | NTV, linear | AIPW RD, linear |
|---|---|---|---|---|
| First | 0.43 | −0.84 | 0.39 | −7.65 |
| Last | 0.44 | −1.58 | 0.40 | −8.87 |
| Median | 0.43 | −0.88 | 0.41 | −9.96 |
| First + last | 0.45 | −0.03 | 0.42 | −8.48 |
| First + last + median | 0.47 | −0.09 | 0.42 | −8.16 |
More columns meant slightly less overlap, as theory predicts, but NTV stayed between 0.39 and 0.47 for every summary, far from full separation. The estimates moved more (Figure 5, which also shows double machine learning, introduced under Decision 3): forest AIPW ranged from −1.58 to −0.03 pp and linear AIPW from −9.96 to −7.65 pp. For every estimator, the summary mattered less than the model class (Decision 4).
Figure 5. Estimates by feature summary, 24 h window, all confounders. First + last rows are from the main run, the others from a separate feature-summary run (50 bootstrap replicates each).
Decision 3. The estimator: doubly robust over propensity score matching or IPW, if the models fit
In short. With random forests inside, the estimators ranged from −2.84 pp (IPW) to −0.03 pp (AIPW), a spread of 2.81 pp. Propensity score matching with forests failed outright, at +67.30 pp.
With the cohort and confounders fixed, a recipe is still needed to turn the data into one number. Each of the five estimators compared takes one of the two routes in the identification formula, or both. Each is introduced below with its idea in plain words first, then its formula.
Outcome model (g-formula). Predict each patient's risk under both treatments and average the difference. Here it is fitted as one model per arm, a T-learner. m1 and m0 are fitted mortality models for the treated and the untreated. It is right if they are right. Its weakness is extrapolation: m1 learns from treated patients, mostly cardiac-surgery patients here, and must predict for medical-ICU patients who look nothing like them.
Propensity score matching. Pair each patient with the most similar patient in the other arm, judged by propensity score, and compare outcomes within pairs. Matching is one of the most widely used methods in RWE, and one with many hidden settings: the propensity model, the caliper (the largest propensity gap allowed between matched patients), the number of matches, and whether a patient can be matched more than once. For matching with a fixed number of neighbours, the standard bootstrap is invalid (Abadie and Imbens, 2008), so the bootstrap intervals for matching here have no theoretical grounding.
The factor 2Ai − 1 makes each pair contribute treated minus untreated.
Inverse propensity weighting (IPW). Reweight patients so that each arm looks like the whole population. A treated patient with a propensity of 0.2 is the kind of patient who usually does not get albumin, so they stand in for five similar patients and get weight 1/0.2 = 5. A treated patient with propensity 0.9 gets weight 1.1. IPW is right if the propensity model is right. Where overlap is poor, a few weights become huge and the estimate becomes unstable.
Doubly robust estimation (AIPW). Make a first guess with the outcome model, then correct it with that model's own errors, weighted by the propensity score. If the outcome model is right, its errors average to zero and the correction vanishes. If the propensity model is right, the weighted errors cancel the outcome model's bias. The estimator gets two chances to be right, which is where the name "doubly robust" comes from.
Double machine learning (DML). Strip out of both the outcome and the treatment whatever the confounders predict, then regress what is left of one on what is left of the other. The treatment residual is the part of the treatment decision the confounders cannot explain, the closest the data come to a coin flip (Chernozhukov et al., 2018). Small errors in either model have only a second-order effect on the estimate, and because no propensity sits in a denominator it is less sensitive to extreme propensities. In the form shown, DML stays right when the propensity model is right, but it is not doubly robust in AIPW's sense. It also estimates a weighted average effect, with most weight on patients whose treatment was least predictable, which equals the average treatment effect when the effect is the same for every patient.
ℓ predicts mortality from the confounders alone.
Table 5. The five estimators. Last column: main-run estimate, 24 h window, all confounders, first + last values, RD in pp.
| Estimator | Models it fits | Correct if | Fails when | Linear / forest |
|---|---|---|---|---|
| Outcome model (T-learner) | Outcome, per arm | Outcome model right | Arms differ, so the model extrapolates | −5.09 / −1.22 |
| Propensity score matching | Treatment | Propensity right and matches close | Poor overlap; tuning choices; bootstrap invalid | +1.36 / +67.30 |
| IPW | Treatment | Propensity right | Propensities near 0 or 1 give huge weights | −2.78 / −2.84 |
| AIPW | Treatment and outcome | Either model right | Both wrong, worst where propensities are extreme | −8.48 / −0.03 |
| DML | Treatment and outcome | Propensity right, effect similar across patients | Propensity wrong, or the effect varies widely | −5.91 / −1.34 |
The last column already shows the problem Decision 4 is about. The same estimator gives very different answers depending on the models fitted inside it.
Decision 4. The models inside the estimator: the biggest lever
In short. The same AIPW estimator gave −8.48 pp with linear models and −0.03 pp with random forests, a spread of 8.45 pp, the largest in the study. A super learner that chose the models by out-of-fold prediction error alone gave −0.17 pp.
The propensity model ê and the outcome models m are the nuisance models. Each is fitted with two classes. Ridge-penalized logistic or linear regression treats each predictor as a straight-line effect. Random forests can capture curves and interactions. The trade-off is between simple models that may be misspecified and flexible models that may overfit. Hyperparameters for both were tuned by cross-validated random search before fitting.
Why the models matter so much: error times error
The bias of AIPW has a compact form that explains the whole section (Chernozhukov et al., 2018): it is the propensity model's error multiplied by the outcome model's error. If either error is near zero, the product is near zero, which is double robustness written out. If both models are wrong for the same patients, the errors multiply. "Doubly robust" is a property of the estimator only if at least one of the two models fits.
Dividing by ê or 1 − ê magnifies the product exactly where propensities are extreme.
Cross-fitting: no model grades its own homework
Flexible models bring a second hazard. A forest can memorize its training patients, and if their fitted values are then plugged into AIPW, the overfitting leaks into the estimate. Cross-fitting prevents this. The data are split into K folds, and each fold's predictions come from models fitted on the other K − 1, so every patient's predictions come from models that never saw that patient.
AIPW and DML used 5-fold cross-fitting. IPW and the T-learner were fitted once on the full data, because the libraries offer no cross-fitting for them; a fairer comparison would cross-fit these too. Intervals come from refitting everything on 10 to 50 bootstrap resamples.
What the models did: linear AIPW missed by 8 points, forests matched the trial
With window, confounders and feature summary fixed, all five estimators were run with both model classes (Figure 6). The model class produced the largest shift in the study. AIPW gave −8.48 pp with linear models and −0.03 pp with random forests. DML gave −5.91 and −1.34 pp. Linear AIPW landed further from the trial than the crude difference, so the adjustment made the answer worse. IPW barely changed (−2.78 and −2.84 pp). The forest outcome model's interval (−20.74 to 18.30 pp) is too wide to rule out any relevant effect. Forest matching returned +67.30 pp, with an interval reaching 148.23 pp, beyond the possible range of a risk difference. No diagnosis of this failure was published. Matching in general discards patients with no close enough match, and its variance is high when there are many covariates and extreme propensities are common (Doutreligne et al., 2024).
Figure 6. Estimates by estimator and nuisance model, 24 h window, all confounders, first + last values. Super-learner rows are new to this analysis.
The bias formula explains the pattern. For linear AIPW to miss by 8 points, both linear models must be misfit in the same patients. Extreme propensities do not look like the amplifier here: linear propensities separated the arms slightly less than forest ones (NTV 0.42 against 0.45, Table 4). With the same data and the same confounders, forests reached the trial answer, so the error most likely came from the models, not the design. Doubly robust estimators with flexible nuisance models are the safer default.
That leaves a governance problem. If the model class can move the answer by 8 points, a single class chosen by hand is the weakest link in the analysis, and the choice is rarely in the protocol.
How to choose the right model: by prediction error, never by the estimate
One approach is off the table from the start: picking the model whose estimate looks most plausible. That turns the estimate into a choice, and it is exactly what a reviewer worries about. The bias formula above points to a rule that never looks at the estimate: if overlap holds, the worst-case bias is bounded by how well each model predicts on patients it has not seen. Prediction error can be measured without touching the causal answer, using the out-of-fold Brier score or log-loss for the propensity model and the out-of-fold error for the outcome model. With every fitted propensity at least η away from 0 and 1, the Cauchy–Schwarz inequality gives the bound:
The norms are root-mean-square prediction errors across patients.
That gives four practical rules:
- Score models only on held-out prediction. Compare candidates by their out-of-fold loss for treatment and for outcome, never by the effect estimate they produce.
- Do not bet on one model class. Stack several (penalized regression, random forests, gradient boosting) with a super learner, which in large samples predicts essentially as well as the best single candidate (van der Laan et al., 2007).
- Fix the rule before the data. Write the candidate library, tuning grids, loss and folds into the statistical analysis plan (SAP), so the selection is auditable and blind to the result.
- Then check overlap. A model that predicts treatment better also separates the arms more, pushing propensities toward 0 and 1 and shrinking η. Report the propensity distribution; the confounder set, fixed by the causal graph, keeps pure predictors of treatment (instruments) out of the model.
The super learner: how it works, and why it helps
The remedy is to stack models of different complexity instead of choosing one (Doutreligne et al., 2024). A super learner turns the question "which model?" into a question settled by held-out prediction error (van der Laan et al., 2007). Think of it as an audition judged only on prediction accuracy, by judges who never see the causal estimate.
It works in four steps. Start with a library of J candidate learners, here a penalized regression, a random forest and gradient boosting. Split the patients into V folds. Fit every candidate V times, each time leaving one fold out, and keep its predictions for the patients it did not see (its out-of-fold predictions). Then choose the combination of candidates that predicts best out of fold. The final model refits each candidate on all patients and combines them with weights set by that out-of-fold comparison. Because every weight is chosen on held-out predictions, a candidate that overfits gains nothing: its out-of-fold predictions are poor, so it gets little weight. With f̃j a candidate's out-of-fold predictions, the combination weights solve:
L is the loss: squared error for the outcome model, log-loss or the Brier score for the propensity model.
Why this is a safe default: in large samples, a result called the oracle inequality guarantees that the super learner does essentially as well as the best single candidate. Nobody has to know in advance which candidate that is. Adding a candidate costs almost nothing, and if one candidate is close to the truth, the stack inherits its accuracy. Written out (van der Laan et al., 2007), with R(f) for a model's expected loss and f0 for the true function, choosing among the candidates by cross-validation gives, for any ε > 0:
The left side is how far the super learner is from the truth. The right side is how far the best candidate is, plus a penalty that grows only with the logarithm of the number of candidates and shrinks with the sample size. The same guarantee extends to the best weighted combination.
That property is what the doubly robust estimator needs. Its bias is bounded by the product of the two nuisance errors, and its confidence interval is valid when that product shrinks faster than the sampling error (Chernozhukov et al., 2018):
oP(n−1/2) means the product shrinks faster than 1/√n, the rate at which sampling error itself shrinks. A misspecified linear model fails this condition. Its error does not shrink as the sample grows, so the bias stays however many patients are added, which is what the linear AIPW estimate of −8.48 pp looks like. A flexible model can, under smoothness conditions, shrink its error at a rate such as n−1/4, and two such errors multiplied shrink fast enough. A super learner picks from the data whichever candidates shrink their error fastest, which gives the condition, and with it double robustness, its best chance of holding in practice.
The super learner on the albumin data
Here each nuisance model in AIPW and DML was replaced with such a stack. The candidates were the penalized linear model and random forest used above, plus histogram gradient boosting, each tuned once on the full data by random search (10 draws, 5 folds). Tuning scored the treatment model by Brier score and the outcome model by R². The linear and forest tuning grids are the original ones; the gradient-boosting grid comes from a later version of the published code. A meta-learner then combined the candidates' 5-fold out-of-fold predictions: logistic regression for the propensity model, non-negative least squares for the outcome model. Cross-fitting and the 50-replicate bootstrap are unchanged from the published code, and hyperparameters stay fixed after tuning. Each estimator took about 17 minutes on 64 vCPUs.
The treatment meta-learner is scikit-learn's default logistic regression (L2 penalty, C = 1) on the candidates' predicted probabilities. The outcome weights are non-negative but need not sum to one.
With super-learner nuisance models, AIPW gave −0.17 pp (−1.68 to 1.34), against the trial's −0.16 pp, and DML gave −0.86 pp (−2.63 to 0.92) (Figure 6). The DML interval now includes zero; with forests (−2.37 to −0.30) it did not.
The diagnostics show how the stack decided (Table 6). It gave the linear candidates the least weight, and they also fitted worst out of fold. The stack was marginally ahead of its best single candidate on treatment AUC (0.846 against 0.842) and outcome Brier score (0.1219 against 0.1227), and marginally behind gradient boosting on treatment Brier score (0.1150 against 0.1147), all from one run without intervals. Its propensities separated the arms more than either single class did: an NTV of 0.52, against 0.45 with forests and 0.42 with linear models (0 means the arms are indistinguishable, 1 means fully separated). That is the cost rule 4 warns about. 0.52 is above every NTV in Table 4 (0.39 to 0.47), so a study using the stack should report the full propensity distribution, not only the estimate.
Table 6. Super-learner diagnostics. Each cell gives the AIPW fit, then the DML fit. Treatment coefficients are on candidate probabilities in the logit and are not weights; outcome weights are non-negative least squares. Out-of-fold (OOF) candidates use the stack's inner 5-fold split, the stack an outer 5-fold split. AIPW's outcome model includes treatment; DML's does not.
| Model and measure | Penalized linear | Random forest | Gradient boosting | Stack |
|---|---|---|---|---|
| Treatment: meta-learner coefficient | 0.35 / 0.60 | 3.90 / 3.30 | 2.63 / 2.77 | Intercept −3.17 / −3.15 |
| Treatment: OOF AUC | 0.786 / 0.785 | 0.840 / 0.836 | 0.842 / 0.842 | 0.846 / 0.845 |
| Treatment: OOF Brier score | 0.1292 / 0.1293 | 0.1157 / 0.1161 | 0.1147 / 0.1147 | 0.1150 / 0.1150 |
| Outcome: meta-learner weight | 0.23 / 0.20 | 0.40 / 0.38 | 0.42 / 0.47 | Intercept −0.01 / −0.01 |
| Outcome: OOF AUC | 0.778 / 0.774 | 0.790 / 0.790 | 0.793 / 0.794 | 0.798 / 0.797 |
| Outcome: OOF Brier score | 0.1262 / 0.1268 | 0.1230 / 0.1231 | 0.1227 / 0.1227 | 0.1219 / 0.1219 |
This is one dataset and one question, with one run per estimator, and no retuning inside each bootstrap refit, so the intervals leave out tuning variability. The stack's own intervals (half-widths of about 1.5 pp for AIPW and 1.8 pp for DML) cannot separate no effect from a benefit or harm of about one point.
Decision 5. Vibration analysis: report every reasonable alternative
In short. With forest models, each design choice moved the estimate by 1.55 to 3.06 pp; with linear models every range was wider. A misfit model exaggerates every other choice.
Several choices above had more than one reasonable option. Redoing the analysis under each and comparing the results gives error bars that go beyond a single statistical model. Following Patel and colleagues, this is called a vibration analysis. NICE asks for the same thing in its own terms: "Sensitivity analyses should reflect areas with the greatest concerns about risk of bias, or when data curation or analytical decisions were made despite notable uncertainty," including "differing time windows" and "alternative model specifications" (NICE RWE framework). The windows, confounder sets, feature summaries, estimators and model classes above are the main experiments of that vibration analysis, and Figure 2 puts them side by side. For that spread to mean anything, the analysis itself has to be reproducible: the same code on the same data should give the same number. The section on reproducing the published analysis checks that.
All choices on one scale
Table 7 sets the ranges of Figure 1 beside the same ranges with linear models inside the estimator.
Table 7. Effect of each analytic change on the 28-day RD: lowest to highest estimate, pp (spread).
| Change | Random-forest nuisance models | Linear nuisance models |
|---|---|---|
| Treatment window, 6 to 72 h (AIPW) | −1.87 to +1.01 (2.88) | −8.56 to −2.97 (5.59) |
| Confounder set, 4 sets (AIPW) | −3.34 to −0.28 (3.06) | −10.02 to −2.26 (7.76) |
| Feature summary, 5 choices (AIPW) | −1.58 to −0.03 (1.55) | −9.96 to −7.65 (2.31) |
| Estimator: IPW, outcome model, DML, AIPW | −2.84 to −0.03 (2.81) | −8.48 to −2.78 (5.70) |
| Estimator: propensity score matching | +67.30 | +1.36 |
| Model class, linear to forest (AIPW) | −8.48 to −0.03 (8.45) | |
Subgroups: only after the average checks out
Once the average agrees with the benchmark trial, the same machinery can ask whether the effect differs between groups, through the conditional average treatment effect (CATE). DML's treatment coefficient is allowed to vary with chosen features XCATE.
Ỹ and à are DML's outcome and treatment residuals.
The effect modifiers were age, septic shock, sex and race, with a ridge final model fitted on 80% of the cohort and effects predicted on the other 20%. Albumin looked beneficial in patients with septic shock, in those aged 60 or over and, less so, in men (Doutreligne et al., 2024). The shock finding agrees in direction with the ALBIOS post-hoc subgroups: a 90-day relative risk of 0.87 (0.77 to 0.99) with shock and 1.13 (0.92 to 1.39) without (Caironi et al., NEJM 2014).
The final model is a choice too. With a random forest in its place, the predicted effects were harmful in every subgroup, which contradicts the null average and most likely reflects a forest that underfits. For anyone building a value story on a subgroup, the order matters: validate the average against a reference first, pre-specify the modifiers, estimate on held-out data, and show the result under more than one final model. The CATE models were not rerun here.
Reproducing the published analysis: within 0.19 pp
The published code was rerun on MIMIC-IV 2.2, with ICU length of stay recomputed and rounded to two decimals, the step needed to match the published cohort count. It reproduced the 18,421 patients, the 28-day deaths (449 and 2,913) and the crude RD of −6.98 pp exactly, and regenerated the published baseline table byte for byte. Six fresh linear-model fits came within 0.19 pp of the published estimates, and a 72 h forest DML fit within 0.02 pp (Table 8).
Table 8. Fresh fits of the published code against the published estimates, MIMIC-IV 2.2, 24 h cohort unless stated. RD for 28-day mortality, pp; difference is fresh minus published.
| Estimator and nuisance models | Feature summary | Published | Fresh | Difference |
|---|---|---|---|---|
| DML, linear | First | −6.71 | −6.70 | +0.01 |
| DML, linear | First + last | −5.91 | −5.84 | +0.07 |
| AIPW, linear | First | −7.60 | −7.71 | −0.11 |
| AIPW, linear | First + last | −8.48 | −8.45 | +0.03 |
| Outcome model (T-learner), linear | First | −5.43 | −5.43 | 0.00 |
| Outcome model (T-learner), linear | First + last | −5.09 | −4.90 | +0.19 |
| DML, random forests, 72 h cohort | First + last | −1.06 | −1.08 | −0.02 |
The small differences, at most 0.19 pp, come from a few covariates, among them Charlson diabetes and SAPS II, whose values differ slightly between the original 2023 build of the derived tables and the rebuild for this rerun. With the inputs fixed, the same fit run three times agreed with itself to within 0.01 pp. The pipeline reproduces, and the published estimates stand.
Limitations
Everything here comes from one dataset and one question. MIMIC-IV is a single US centre whose patients were less ill than those in ALBIOS, so a choice that worked here may not work elsewhere. The benchmark has its own uncertainty. The ALBIOS interval runs from −4.47 to 4.16 pp. It contains forest IPW (−2.84 pp) as well as forest AIPW (−0.03 pp) and the super learner (−0.17 pp), so agreement with the trial cannot rank those analyses. The emulated treatment strategy also differs from the trial's (Table 3). Agreement with the trial is a weak check and cannot rule out unmeasured confounding.
ICU unit and calendar period are not adjusted for, and severity enters only through recorded scores. An exploratory clone-censor-weighting analysis is not reported because its diagnostics failed. In that analysis, 390 treated-arm clones (the patient copies described under Decision 1) were still in follow-up at the end of the grace period, the hours allowed for albumin to start. Weighting left them an effective sample size of 110. The largest weight was 71, and weighting made balance worse on several covariates (age standardized mean difference −0.12 unweighted, −0.24 weighted). Not yet run: clone-censor-weighting with time-varying weights, overlap checks and trimming by ICU unit, the ALBIOS septic-shock subgroup as a second benchmark, multiple imputation, and estimators built on other principles (entropy balancing, covariate-balancing propensity scores, TMLE and BART).
What this means for an RWE or HEOR lead: five questions before sign-off
Design, confounder choice and estimator choice matter about equally: ignoring any one gives an invalid estimate, while imperfect but plausible choices at each step lead to small biases of the same order. The extensions here agree on direction and add one thing: on one scale, the models inside the estimator mattered most.
For albumin itself, the best-specified analyses agree with the trials: no detectable average effect on 28-day mortality. The crude seven-point benefit is best explained by who received albumin, and a weak choice at any of several steps (socio-demographics alone: −3.34 pp; linear models: −8.48 pp) would have reported a benefit the trials never found.
For the people who sign off on RWE, the practical lesson is that the number in a report is only as good as the least-examined decision behind it. ICH M14 asks that sensitivity analyses vary "design, exposure definition, outcome definition, missing data, and limitations of the data source(s) selected, and analysis approach," pre-specified "in the protocol and or the SAP" (ICH M14). NICE asks that results be presented "for adjusted and unadjusted analyses and for all subgroup and sensitivity and bias analyses" (NICE RWE framework). Before a number goes into a dossier, a submission or a publication, five questions are worth asking:
Table 9. Five questions to ask before signing off on an RWE estimate, and what moved here when the answer was weak.
| Question | What a good answer contains | Moved here by |
|---|---|---|
| 1. When does follow-up start, and is anyone classified using what happened later? | Target trial table; time zero aligned in both arms; window varied | 2.9 pp |
| 2. Where did the confounder list come from? | Causal graph with sources; nothing post-treatment; treatment tabulated by site, unit and period | 3.1 pp |
| 3. Why this estimator? | Doubly robust primary; matching with bootstrap intervals kept out of the primary analysis | 2.8 pp |
| 4. Which models sit inside it, and who chose them? | Cross-fitted; chosen by out-of-sample prediction accuracy under a pre-specified rule, never by the estimate; out-of-fold fit reported | 8.5 pp |
| 5. Which alternatives were run, and are they all reported? | Every pre-specified alternative on one forest plot beside the primary; the primary gives the same number when rerun | — |
Ranges are for AIPW with random-forest models, except question 4 (linear to forest). For scale: the true effect is about zero, and the trial's own 95% interval is about ±4.3 pp.
How Frekil builds these checks into every study
Frekil is an AI RWE platform that designs and runs observational studies the way this post recommends, with the decisions above written down and fixed before any data are queried. How it works:
- Target trial emulation from the start. Every study begins with a target trial table: eligibility, treatment strategies, time zero and the estimand. Exposure is classified only from what is known at time zero, so no arm is defined by what happens later.
- Confounders from a cited causal graph. Each edge in the graph carries a source, the adjustment set is read off it, and covariates are never selected by data-driven methods.
- A statistical analysis plan locked before data. The SAP names the primary estimator and specifies every model inside it. When a model is fitted by machine learning, the SAP states the algorithm, how its tuning parameters are chosen and the metrics that validate it. Cross-fitted doubly robust estimators are the supported route to valid intervals with such models. Balance and overlap are checked before any outcome is examined, with a pre-specified response if they fail.
- Sensitivity analyses ranked by threat. The plan ranks the threats most likely to make this study's answer wrong, such as unmeasured confounding, misclassification, censoring or model specification. The analyses that test them come first, including quantitative bias analysis where plausible bias parameters exist.
- Control outcomes alongside the main question. Negative and positive control outcomes run on the same cohort, so the design's bias is measured instead of assumed (see negative controls and empirical calibration).
- Code that can be opened. The AI writes the code, never the result. Every number comes from code that can be read and rerun.
The same discipline applies whether the study supports HEOR and comparative effectiveness, a label expansion, or a safety question. For more on the estimators, see propensity scores in real-world data and propensity score methods for survival outcomes.