Emulating the trial you can't run

A guided pre-reading on target trial emulation, time zero, and the biases good design prevents

Current Topics in Biomedical Informatics and Data Science
Johns Hopkins Biomedical Informatics and Data Science · Seminar of November 5, 2026

Using synthetic patients where we know the true answer, we explore causal inference and the design biases in observational studies, and show methods that reduce them. Every number after Part 1's opening story is hypothetical.

What to take away. This is a demonstration of a few tools, not a full course: causal inference takes a semester or more to teach. The core lesson is that in observational data, a comparison of two groups can be badly biased even when the p-value is small and the confidence interval is narrow. Depending on your background and goals, you may come away with a sharper eye for when that bias is present and when it isn't. Or you may come away curious to learn these methods in depth.

Practice questions

Ten short questions are spread through this reading. They aren't graded. They help you check your understanding as you go, and they show us which ideas were hard. You'll see right away if you're right; if not, you get a hint and can try again.

Enter your name and the class PIN from the Canvas assignment to turn them on. Use the same name each time and your answers come back on any device. We store a scrambled code made from your name, not the name itself.

Part 1 · Why we need a target trial

A cautionary tale

For decades, observational studies suggested that hormone therapy after menopause protected women's hearts. In the Nurses' Health Study, women currently using hormones had about 40% fewer major coronary events than women who had never used them (relative risk 0.61).¹

Then the Women's Health Initiative randomized 16,608 women to estrogen plus progestin or placebo. The women assigned to hormones had more coronary heart disease (hazard ratio 1.29), and the trial was stopped early in 2002 because the risks outweighed the benefits.²

Same question, opposite answers. Was the observational data useless?

In 2008, Hernán and colleagues went back to the Nurses' Health Study and analyzed it as if it were a trial. They compared women who started hormones with women who didn't, with follow-up starting at the moment of that decision. Now the observational data pointed to more heart disease in the first two years after starting hormones, as in the trial, and the authors judged their estimates similar to the trial's.³

No description has been provided for this image

The data didn't change. The design did. The authors found the remaining differences were largely explained by who was compared (how long after menopause) and for how long (the early years vs the whole follow-up).³ There was likely one more reason the original analysis missed the early harm: "current users" had often been taking hormones for years, so the women harmed early on had already dropped out of that group.

¹ Grodstein et al., Ann Intern Med 2000;133:933-941. ² Writing Group for the Women's Health Initiative Investigators, JAMA 2002;288:321-333. ³ Hernán et al., Epidemiology 2008;19:766-779.

The idea: name the trial you wish you could run

A target trial is the randomized trial that would answer your question if you could run it, with no limits on money, time, or ethics committees.

Target trial emulation means writing that trial's protocol down, then copying each part of it as closely as you can with data you already have: electronic health records, insurance claims, registries. If the emulation works, it gives the same answer the trial would have, apart from chance.

The protocol forces you to answer questions that are easy to skip. Who is eligible, and when? What exactly is each group supposed to do? When does the clock start?

Words you'll need

Term Plain meaning
Target trial The randomized trial you would run to answer your question.
Emulation Copying that trial, step by step, with data collected for other reasons.
Eligibility criteria Who can enter. They must be checked at time zero, using only what's known then.
Treatment strategy Exactly what each group is supposed to do, like "start a statin today" vs "don't start today."
Assignment How people end up in a group. In a trial, a coin flip (randomization). In real-world data, whatever the patient and doctor chose.
Time zero (baseline) The moment follow-up starts. In a trial, it's when people are randomized.
Follow-up The time from time zero until the outcome, the end of the study, or until we lose track of someone.
Outcome What we count, like death by day 28.
Intention-to-treat effect The effect of being assigned to (or starting) a strategy, whatever happens afterward.
Per-protocol effect The effect of actually following the strategy as written.
Confounder Something that affects both who gets treated and the outcome, like how sick a patient is.
Censoring Ending someone's follow-up early in an analysis. Nothing after that moment counts.
Risk difference per 100 The risk in one group minus the risk in the other, out of 100 people. "−3 per 100" means 3 fewer deaths for every 100 patients treated.
95% confidence interval The range of answers that fit the data, given chance alone. It says nothing about bias.

The secret of a randomized trial: time zero

In a trial, three things happen at the same moment. A person is checked for eligibility, assigned to a group, and follow-up starts. That moment is time zero.

Observational analyses often break this alignment without noticing. The rule is simple: eligibility is checked at time zero, not later, and outcomes count only after time zero, never before. Hernán and colleagues have called the errors that follow "self-inflicted injuries."⁴

No description has been provided for this image

Check your understanding · Select all that apply

In a randomized trial, which of these happen at time zero? Select all that apply.

Enter your name and the class PIN at the top to answer.

Three biases we'll control for

1. Immortal time

Suppose you sort patients by what they do after time zero: "ever treated" vs "never treated." To be counted as treated, a patient had to survive long enough to get the treatment. The time before their first dose is immortal: they couldn't have died in it and still ended up in the treated group. Meanwhile, patients who die early are all counted as untreated. The treatment looks better than it is, sometimes much better.⁵

Check your understanding · Choose one

Suppose doctors started a drug at random times, so there is no confounding. A study still compares patients who were ever treated with patients who were never treated. Why would the drug look better than it really is?

Enter your name and the class PIN at the top to answer.

2. Confounding

In real life, treatment isn't a coin flip. Doctors treat the patients who seem to need it most. If sicker patients are both more likely to be treated and more likely to die, the treatment looks harmful even when it helps. That's confounding by indication. The reverse happens too: healthier people are more likely to take preventive drugs, so those drugs look better than they are (the healthy-user effect).

No description has been provided for this image

The fix is adjustment: compare treated and untreated patients who look alike on the confounders, using regression, matching, weighting, or standardization. It works only for confounders someone recorded.

3. Prevalent-user selection

Compare people currently taking a drug with people who never took it, and you've started follow-up years after treatment began. Two things go wrong:

  • Survivors only. People harmed early by the drug, or who stopped it because of side effects, are no longer "current users."
  • Measurements on the drug. Their baseline values (cholesterol, blood pressure) were measured after the drug changed them.

The fix is a new-user design: start the clock when people start (or don't start) the drug.

Two kinds of problems, two kinds of fixes

Problem What causes it What fixes it
Immortal time Groups defined by something that happens after time zero Design: assign groups at time zero, using only what's known then
Confounding Treated and untreated patients differ before treatment Analysis: adjust for confounders, but only the ones that were recorded
Prevalent-user selection Follow-up starts long after treatment began Design: compare new users, starting the clock when treatment starts
No amount of adjustment fixes a broken time zero. No design fixes a confounder nobody recorded.

Check your understanding · Select all that apply

Which of these problems can adjustment (regression, matching, weighting, or standardization) fix? Select all that apply.

Enter your name and the class PIN at the top to answer.

How we'll learn it: worlds where we know the truth

Real data never tell you whether you got the right answer. So we built two simulated worlds where we set the true effect of a drug, then analyzed each world's records the way published studies do.

Every patient has two potential outcomes: what would happen with the treatment, and what would happen without it. Real data only ever show one. A simulation can show both: we run every patient twice, once under each strategy, with the same random "luck" both times. We call this the perfect experiment. It's the answer key, and every analysis gets measured against it.

World The time-zero puzzle The method
Part 2 An ICU: hydrocortisone in septic shock Treatment can start any time in the first 24 hours, so at time zero you can't tell who's in which group Clone-censor-weight
Part 3 A clinic: statins after age 75 People are eligible at every visit. Which visit is time zero? Sequential trials

⁴ Hernán et al., J Clin Epidemiol 2016;79:70-75. ⁵ Suissa, Am J Epidemiol 2008;167:492-499.

Part 2 · Clone-censor-weight: hydrocortisone in septic shock

The question

Septic shock is sepsis with low blood pressure that needs vasopressor drugs, plus a high lactate despite IV fluids. Hospital mortality is over 40%.⁶ Low-dose IV hydrocortisone, a steroid, is a common add-on, and whether it saves lives is still debated.

Our question: among adults with septic shock, does starting hydrocortisone within 24 hours of shock onset, compared with not starting it in the first 24 hours, change the risk of death by day 28?

The target trial, and how we'll emulate it

Here is the protocol, written out component by component. We list the start of follow-up, time zero, as its own row, because that's where things go wrong.

Component Target trial (the trial we'd run) Emulation (with the hospital's records)
Eligibility Adults in their first episode of septic shock, which began in this hospital, not taking steroids at home The same rules, from age, transfer status, prior episodes, and the home medication list. Also must have a lactate result, a key confounder.
Treatment strategies A: start IV hydrocortisone within 24 h of shock onset. B: no hydrocortisone in the first 24 h; usual care after. The same, read from medication administration times
Assignment Random, at shock onset The team's choice. Adjust for age, sex, SOFA score, lactate, norepinephrine dose, and limits of care.
Time zero Randomization, at shock onset Shock onset (the first vasopressor), for every patient
End of follow-up Death or day 28 The same
Outcome Death from any cause by day 28 The same, from the death date in the records
Causal contrast Per-protocol: following A vs following B Per-protocol, by clone-censor-weight
Analysis plan Compare the 28-day risk of death Weighted risk curves, with bootstrap 95% CIs

The tricky part is strategy A. It allows 24 hours to start, because no ICU can give a drug the instant a patient is randomized. This is called a grace period. During those 24 hours, a patient who hasn't started yet is following both strategies. Keep that in mind.

⁶ Singer et al., JAMA 2016;315:801-810 (Sepsis-3).

Our simulated ICU

Each patient is followed in 6-hour shifts for 28 days. In every shift, two things can happen:

  1. The team may start hydrocortisone. The chance depends on how sick the patient looks.
  2. The patient may die. The chance depends on how sick they are, and on whether they're on hydrocortisone.

We wrote down the rules ourselves. They're plausible, but we made them up. The most important one: hydrocortisone lowers the odds of dying in each shift by 20% (an odds ratio of 0.80). That's the truth every analysis will try to recover.

No description has been provided for this image

Sicker patients (higher SOFA score, lactate, and norepinephrine dose) are more likely to die and more likely to get hydrocortisone. Those are confounders. Patients with documented limits of care (for example, a do-not-escalate order) die more often but rarely get hydrocortisone. Prescriber style changes who gets treated but not who dies, so it isn't a confounder.

The answer key: a perfect experiment

Here are 12 simulated patients, run three times: once under usual care, once with everyone following strategy A, once with everyone following B. Each patient keeps the same random "luck" in all three runs, so only the strategy differs. Most patients have the same fate either way. Only a few are saved, or lost, by the drug.

No description has been provided for this image

Now do that for 200,000 patients: everyone under A, then everyone under B. It's the target trial done perfectly: no confounding, everyone follows their strategy, nobody is lost to follow-up.

No description has been provided for this image

This is the answer key: starting hydrocortisone within 24 hours prevents about 3 deaths per 100 patients by day 28. Every analysis from here on is measured against that number.

The hospital's records

Real life gets one run, under usual care. Our hospital's records hold 22,000 septic shock admissions, without the hidden variables. We apply the eligibility rules from the protocol, then look at who got hydrocortisone, when, and who died:

No description has been provided for this image

Two things to remember from these pictures:

  • Day 1 is when hydrocortisone usually starts, and it's also the deadliest day. That overlap sets up immortal time.
  • Sicker patients get more hydrocortisone and die more. That's confounding by indication. On its own, it should make hydrocortisone look harmful.

Standard approach 1: ever vs never treated

The most obvious analysis compares patients who ever received hydrocortisone with those who never did. Many published observational studies were built this way.

Ever vs never treated, unadjusted: 13.1 fewer deaths per 100  ·  the truth: 3.3 fewer deaths

Hydrocortisone looks like a miracle drug: about 13 fewer deaths per 100 patients, four times the truth. And it's the opposite of what confounding should do: the treated patients were sicker. Something stronger is pushing the other way. That something is immortal time.

If a patient is in the "treated" group, they could not have died before their first dose. If they had, they'd be in the "untreated" group. So the hours between shock onset and the first dose are guaranteed survival, credited to hydrocortisone. Meanwhile, patients who died early, before anyone could treat them, all count as untreated.

No description has been provided for this image

Standard approach 2: adjust for confounders

The usual next step is to adjust, because the treated patients were sicker. We'll use propensity score weighting (inverse probability of treatment weighting, IPTW). It works in two steps:

  1. Propensity score. A regression predicts each patient's chance of being treated from the confounders. A score of 0.8 means "80% of patients who looked like this got hydrocortisone."
  2. Weights. Each patient counts as 1 ÷ (the chance of the treatment they actually got). An untreated patient with a score of 0.8 was a surprise: they count as 1 ÷ 0.2 = 5 patients, standing in for the similar patients who went the other way.

The weighted groups look alike on every measured confounder, as if treatment had been a coin flip.

Propensity score weighting, four example patients
Patient SOFA Norepi- nephrine Got hydro- cortisone? Propensity score Weight What it means
A 12 0.25 Yes 0.80 1.2 Expected: 80% of similar patients were treated, and this one was. Counts as 1.2 patients.
B 11 0.14 Yes 0.25 4.0 Surprising: 25% of similar patients were treated, and this one was. Counts as 4.0 patients.
C 9 0.35 No 0.80 5.0 Surprising: 20% of similar patients went untreated, and this one did too. Counts as 5.0 patients.
D 9 0.17 No 0.25 1.3 Expected: 75% of similar patients went untreated, and this one did too. Counts as 1.3 patients.
Balance between ever and never treated
Confounder SMD before weighting SMD after weighting
Age 0.25 0.00
Female 0.01 0.01
SOFA score 0.43 0.07
Lactate 0.35 0.05
Norepinephrine dose 0.43 0.15
Limits of care 0.44 0.03
SMD: standardized mean difference, the gap between group averages in standard-deviation units. Below about 0.1 counts as balanced. Norepinephrine stays a little above, because its dose is skewed; close enough here.
No description has been provided for this image

The groups are now balanced, and the answer got worse. Adjustment did its job: it removed confounding by indication, which had been partly cancelling out the immortal time. With that counterweight gone, the immortal time bias shows through in full.

No amount of adjustment can fix groups that were defined using the future. We have to fix the design.

Check your understanding · Type a number

An untreated patient has a propensity score of 0.75: 75% of similar patients got hydrocortisone. With inverse probability weighting, how many patients does this one count as?

Enter your name and the class PIN at the top to answer.

Check your understanding · Choose one

After weighting balanced the groups, the ever-vs-never estimate moved further from the truth. Why?

Enter your name and the class PIN at the top to answer.

The fix: emulate the target trial

Start everyone's clock at shock onset, as the trial would. But there's a catch: at shock onset, we can't tell which strategy a patient is following. A patient untreated at hour 6 might start at hour 12, or never. Thanks to the grace period, their records fit both arms.

The answer is to make two exact copies of every patient: clones. The method is called clone-censor-weight:

  1. Clone. At time zero, copy every patient into both arms.
  2. Censor. Follow each clone only while its patient's records obey its arm's rule. The moment they break it, the clone is censored: from then on, nothing that happens to that patient counts in that arm.
  3. Weight. Censoring isn't random, so reweight the clones that remain to stand in for the ones that left.

Here are the clones of three patients:

No description has been provided for this image
  • Patient 1 started at hour 6. Clone A follows the rule. Clone B broke "no hydrocortisone in 24 h" at hour 6, so it's censored.
  • Patient 2 started at hour 48, too late for A. Clone A is censored at the deadline; clone B follows the rule.
  • Patient 3 died at hour 6, before breaking either rule. The death counts in both arms, just as it would in a real trial for a patient randomized at hour 0 who died before treatment began. No one gets survival time for free.

Clones leave follow-up at different times, so we can't just divide deaths by clones. The Kaplan-Meier method handles that: at each moment, among the clones still being followed, what share die?

Clones, no weights: 2.0 more deaths per 100  ·  the truth: 3.3 fewer deaths

Fixing time zero removed the immortal time, and now hydrocortisone looks harmful. That's confounding coming back through censoring. The sickest patients start hydrocortisone early, so their arm-B clones break the rule and leave. Arm B is gradually left with healthier patients.

Check your understanding · Choose one

Patient 3 died at hour 6, before receiving any hydrocortisone. In clone-censor-weight, where does that death count?

Enter your name and the class PIN at the top to answer.

Weighting the clones that remain

The fix mirrors propensity score weighting. A regression predicts each patient's chance of starting hydrocortisone in each first-day shift, from the same confounders. An arm-B clone that stayed untreated is weighted by 1 ÷ (its chance of staying untreated that long). A very sick patient who stayed untreated is rare, so their clone counts extra, standing in for the similar clones that were censored.

Censoring weights, three example arm-B clones
Norepinephrine, SOFA Chance of starting at 0 / 6 / 12 / 18 h Chance of staying untreated to 24 h Weight in arm B
0.08, 2 2% / 1% / 1% / 1% 94% 1.1
0.15, 5 11% / 10% / 9% / 8% 67% 1.5
0.30, 13 17% / 15% / 13% / 12% 54% 1.8
The sicker the patient, the less likely they were to stay untreated, so the more their clone counts.
No description has been provided for this image

With weights, arm B keeps the mix of patients it started with. Now estimate the risks again, with each clone counted by its weight:

No description has been provided for this image
No description has been provided for this image

From the same records, the emulated trial recovers the truth. The solid curves sit on the dashed perfect-experiment curves. Nothing about the data changed. We changed the design, by lining up eligibility, assignment, and time zero the way a trial does, and then handled the censoring that design creates.

What did we estimate? Because each patient sits in both arms at time zero, cloning can't estimate an intention-to-treat effect. What we estimated is a per-protocol effect: what happens if patients follow strategy A vs strategy B.

What design can't fix

Clone-censor-weight assumes we recorded every variable that affects both treatment and death. Our records include limits of care. Many real records don't: it may live only in a free-text note. Here's the same emulation, pretending limits of care was never recorded:

Emulated trial, limits of care not recorded: 6.4 fewer deaths per 100  ·  the truth: 3.3 fewer deaths

The estimate roughly doubles, and nothing in the output warns you. Patients with limits of care rarely get hydrocortisone and often die. If we can't see them, "no hydrocortisone" looks deadlier than it is.

How sure are we?

A real study reports a 95% confidence interval. We get one by bootstrapping: draw patients at random (with replacement) from our records, rerun every analysis, repeat 100 times, and take the middle 95% of the results.

No description has been provided for this image

The emulated trial's interval covers the truth. The standard approaches, and the emulation missing a confounder, have narrow intervals far from the truth. A confidence interval only measures chance; it can't see bias. Precision isn't accuracy, and a bigger dataset would only make the wrong answers look more certain.

The lesson of Part 2: with time zero broken, adjustment made things worse. With time zero aligned, the answer was right only once the confounders were handled too (here, through the censoring weights). Design fixes time zero. Adjustment fixes measured confounding. You need both.

Check your understanding · Choose one

The ever-vs-never analysis gave a narrow 95% confidence interval far from the truth. What would a dataset ten times larger do?

Enter your name and the class PIN at the top to answer.

Part 3 · Sequential trials: statins after age 75

The question

Whether statins help adults over 75 who have never had a heart attack or stroke is a real, open question. Everything below is hypothetical: a made-up clinic with made-up numbers.

Our question: in adults 75 or older with no heart attack or stroke, does starting a statin at a routine visit, compared with not starting at that visit, change the risk of a heart attack or stroke over 5 years?

Why one time zero isn't enough

In Part 2, everyone had an obvious time zero: shock onset. In a clinic, there's no such moment. Our clinic sees each patient every 3 months. At every visit, an eligible patient's doctor might start a statin. So the same person meets the trial's entry criteria at visit 1, again at visit 2, and so on, until they start a statin or have an event. Which visit is time zero?

Two honest choices. When people are eligible many times, there are two unbiased options: (1) pick a single eligible time, like the first, or (2) use all eligible times, starting a new trial at each one. Option 2 is called sequential trials, and it uses the data more efficiently. We'll try both.

Component Target trial (the trial we'd run) Emulation (with the clinic's records)
Eligibility Age 75 or older, no heart attack or stroke, never on a statin, at least 1 year of records The same, from age, diagnoses, and prescriptions, checked at each visit
Treatment strategies Start a statin today vs don't start today (usual care afterward, which may mean starting later) A new statin prescription at this visit, or not
Assignment Random, at the visit The doctor's choice. Adjust for age, sex, diabetes, smoking, blood pressure, and the LDL and frailty recorded at that visit.
Time zero The visit when randomized Every eligible visit in the first 3 years: one trial per visit
End of follow-up A heart attack or stroke, or 5 years The same
Outcome First heart attack or stroke within 5 years The same, from diagnosis records
Causal contrast Intention-to-treat The observational analog of intention-to-treat: initiators vs non-initiators, whatever they do later
Analysis plan Compare 5-year risks Standardization over all the trials pooled; bootstrap CIs that resample people

Our simulated clinic

Each patient is followed visit by visit, every 3 months, for 8 years. At each visit the doctor may start a statin, and over the next 3 months the patient may have a heart attack or stroke. To keep things simple, nobody in this clinic dies of other causes or moves away.

The true effect we built in: a statin lowers the odds of a heart attack or stroke in every 3-month period by 30% (an odds ratio of 0.70). As before, we made up all the numbers.

No description has been provided for this image

Look at frailty: it raises the risk of events but lowers the chance of getting a statin. So statin users will be healthier than non-users for reasons that have nothing to do with the drug: the healthy-user effect. High LDL and diabetes push the other way.

Two of these risk factors change over time. LDL wobbles from visit to visit, and frailty creeps upward. So the reasons a doctor starts a statin this year differ from last year's, and a fair comparison has to use the values recorded at the visit where the decision was made.

The answer key

First, say exactly what we want to know: when an eligible patient comes in for a routine visit, how many heart attacks and strokes over 5 years does starting a statin that day prevent, compared with not starting that day? Averaged over every eligible visit. That's an intention-to-treat question about a decision at a visit. It's not "always on a statin vs never."

The perfect experiment: for each of the 12 trial visits, rewind to that visit and run each eligible patient's future twice, starting and not starting, with the same luck.

No description has been provided for this image

The answer key: starting a statin at an eligible visit prevents about 3.5 heart attacks or strokes per 100 people over 5 years.

The clinic's records

Real life gets one run, under usual care: 20,000 older adults followed for 8 years. The records hold one row per patient per visit, with the LDL as measured (lower if the patient is on a statin), the frailty score, whether a statin was started, and whether a heart attack or stroke followed.

Who starts a statin, and who has events? Each bar covers a quarter of all eligible visits:

No description has been provided for this image

One adjustment method for every analysis

To keep the comparison fair, every analysis below uses the same adjustment. Only the design changes: who is compared with whom, and from when. The method is standardization (also called the g-formula):

  1. Model the outcome in each group. One regression among the treated, one among the untreated, each predicting the chance of an event within 5 years from the confounders.
  2. Predict twice. For every person, ask both models: "what's your risk if treated?" and "what's your risk if not?"
  3. Average. The averages are the risks if everyone were treated, and if no one were. Their difference is the effect.

Standard approach 1: ever vs never users

Start everyone's clock at cohort entry. Call a patient a statin user if they started a statin at any point in the next 5 years, and a never user otherwise. Adjust for everything measured at entry.

Ever vs never users: 7.9 fewer events per 100  ·  the truth: 3.5 fewer events

Statins look more than twice as protective as they are. It's immortal time again: to be counted as a "statin user," a patient had to stay event-free until their first prescription. Anyone who had a heart attack first ended up a "never user."

No description has been provided for this image

Standard approach 2: current users vs non-users (prevalent users included)

Fix the immortal time by grouping people at entry: on a statin today vs not. That's how the original hormone therapy studies compared "current users" with "never users." It brings the prevalent users back in.

Current users vs non-users at entry: 0.1 more events per 100  ·  the truth: 3.5 fewer events

Now the statin looks useless. Why? Look at the cholesterol the records hold for each group:

No description has been provided for this image

Prevalent users' baseline LDL was measured on the drug. The records make them look like people with naturally low cholesterol, when they're really high-risk people whose cholesterol is being treated. Adjusting for that on-treatment LDL hides their risk, so the statin seems to do nothing.

That's one of the two prevalent-user problems from Part 1. The other, survivors only, isn't built into this simulation, but it's the one from the hormone therapy story in Part 1: women harmed early had already dropped out of the "current users" group. Either way, the direction of the bias is hard to predict, which is why target trial emulations compare initiators (new users).

Check your understanding · Choose one

Comparing current statin users with non-users made the statin look useless. What was the main reason in this simulation?

Enter your name and the class PIN at the top to answer.

A valid design: one trial at cohort entry

Now do it right, but only once: a single target trial at cohort entry, choice (1). Eligible: the new-user cohort at visit 0. Initiators started a statin at that visit; non-initiators didn't (and may start later). Everything uses information available at time zero.

No description has been provided for this image

This design is valid: no immortal time, no prevalent users. It answers a slightly narrower question (a decision at cohort entry), whose true answer is the solid tick. But only a few hundred people started a statin at that one visit. Everyone who started later is thrown away. We'll see the cost when we add confidence intervals.

Sequential trials: a new trial at every visit

Choice (2): emulate a new trial at each of the first 12 visits.

  1. Eligible: in the new-user cohort, not yet on a statin, no heart attack or stroke yet, at this visit.
  2. Assignment: initiators started a statin at this visit; non-initiators didn't.
  3. Time zero: this visit. Baseline values are the ones recorded at this visit.
  4. Follow-up: 5 years from this visit, whatever happens to treatment later (intention-to-treat).

Every eligible visit becomes one row of one trial. Here are four patients from our records, and every trial each one joins:

No description has been provided for this image

Read it row by row:

  • A is a non-initiator in all 12 trials.
  • B is a non-initiator in trials 1 to 5, an initiator in trial 6, then gone: on a statin, so no longer eligible.
  • C's single event counts in every trial C joined.
  • D is a non-initiator in the first two trials even though D started later. That's intention-to-treat: each trial groups people by what they did at its own time zero.

Each person is an initiator at most once, so everyone who starts a statin in the first 3 years contributes as an initiator. Here are the stacked rows for patients B and D:

The stacked dataset: one row per person per trial
Patient Trial Time zero (year) Initiated? Age LDL, mg/dL Frailty Event within 5 years?
B 1 0.00 No 81.0 131 4.8 No
B 2 0.25 No 81.2 137 4.9 No
B 3 0.50 No 81.5 131 5.4 No
B 4 0.75 No 81.8 129 5.5 No
B 5 1.00 No 82.0 146 5.6 No
B 6 1.25 Yes 82.2 125 5.7 No
D 1 0.00 No 81.0 134 2.9 Yes
D 2 0.25 No 81.2 126 3.2 Yes
D 3 0.50 Yes 81.5 141 3.3 Yes
Baseline values are those recorded at each trial's own time zero. All 12 trials together: 100,724 rows from 10,400 people.

Initiators have higher LDL and are less frail than non-initiators. First, compare them with no adjustment, then with standardization. We add the trial number to the models, so each trial keeps its own baseline risk.

Sequential trials, no adjustment: 5.6 fewer events per 100  ·  the truth: 3.5 fewer events

Sequential trials, adjusted: 3.4 fewer events per 100  ·  the truth: 3.5 fewer events

From the same records, sequential trials recover the truth. Without adjustment, the healthy-user effect makes statins look too good. Here is standardization at work for three rows of the stacked data. Each row gets both predictions, whatever it actually did; the effect is the average gap over all rows.

Standardization, three example rows
Trial Initiated? Age LDL Frailty 5-year risk if initiated ... if not Gap, per 100
1 Yes 77 160 1.2 10.1% 12.6% -2.5
1 No 81 162 5.1 20.4% 22.4% -2.0
1 No 79 108 7.0 17.8% 21.5% -3.7
No description has been provided for this image

Check your understanding · Choose one

In the sequential trials, Patient D started a statin at a later visit. In trial 1, which group is D in?

Enter your name and the class PIN at the top to answer.

What design can't fix

Sequential trials assume we recorded everything that affects both starting a statin and events. Our records include a frailty score. Many real records don't. The same analysis, pretending frailty was never recorded:

Sequential trials, frailty not recorded: 5.6 fewer events per 100  ·  the truth: 3.5 fewer events

The healthy-user effect comes back, and nothing in the output warns you. Frail patients rarely start statins and often have events. If we can't see frailty, "no statin" looks worse than it is.

How sure are we?

There's a catch. The same person appears in many rows, and their outcomes are linked: patient C's one event counted in every trial C joined. Standard confidence intervals treat every row as a different person, so they come out too narrow. The simple fix is to bootstrap people, not rows: draw patients at random, take all their rows, rerun everything, repeat.

No description has been provided for this image

Resampling rows pretends the non-initiators are about 100,000 different people. They're about 10,000 people, each counted up to 12 times, so that interval is far too narrow. Always resample people.

Here are all of Part 3's results with their 95% confidence intervals:

No description has been provided for this image

Both valid designs land near their own truth, but the sequential trials' interval is about half as wide. The single trial at entry throws away most of the people who started statins. The shortcuts, and the emulation missing frailty, are precise and wrong.

The lesson of Part 3:

  • When people can start a treatment at any time, there's no single obvious time zero.
  • Picking one by looking ahead (ever users) or by ignoring the past (current users) breaks the comparison.
  • Picking one honestly (one trial at entry) works but wastes data.
  • Emulating a trial at every eligible visit keeps the design honest and uses all the information. It still needs adjustment for the confounders, and a confidence interval that knows people repeat.

Check your understanding · Choose one

In sequential trials, the same person appears in many rows. To get an honest 95% confidence interval by bootstrapping, what do you resample?

Enter your name and the class PIN at the top to answer.

Part 4 · Wrap-up

Every analysis from Parts 2 and 3, measured by how far it landed from the truth:

No description has been provided for this image

Key takeaways

  1. Write the target trial's protocol first. Eligibility, strategies, assignment, time zero, follow-up, outcome, causal contrast, analysis. Then copy it, one component at a time.
  2. Line up eligibility, assignment, and time zero. Ever-vs-never and current-vs-never comparisons break that alignment. The resulting biases are large, confident, and can point either way.
  3. Adjustment fixes confounding, and only for what was recorded. It can't fix a broken time zero, and it can make a broken design look worse.
  4. When strategies overlap at time zero (a grace period), clone, censor, and weight. The result is a per-protocol effect.
  5. When people are eligible many times, emulate a trial at each eligible time and pool them. Then resample people, not rows.