Target Trial Emulation
A framework for designing an observational causal study by specifying a hypothetical randomized trial and mapping its eligibility, treatment strategies, assignment, follow-up, outcomes, causal contrast, and analysis onto available data. Aligning time zero helps prevent design biases; it does not remove confounding or measurement error.
On this page
Write the trial you wish you could run, then map each part to the records you actually have. Start the comparison when eligibility, treatment classification, and follow-up line up. This can prevent avoidable timing errors, but it cannot make nonrandom treatment choices behave as though they were randomized.
Target trial emulation (TTE)
specifies the randomized trial that would answer a causal question, then describes how observational data can emulate each protocol component. It is a design framework, not a particular estimator (Hernán & Robins 2016).
The seven components in the original framework are: eligibility criteria; treatment strategies; assignment procedures; follow-up; outcome; causal contrasts; and analysis plan. Time zero is the common start of eligibility, strategy assignment, and follow-up. Record it explicitly within that specification. Eligibility may use information collected before baseline, but must not select participants using their future outcomes or adherence.
Core estimand distinction
In a randomized trial, intention-to-treat estimates the effect of assignment regardless of subsequent adherence. Routine dispensing data usually record treatment initiation, not a separate randomized assignment. Comparing initiators and retaining their initial groups therefore targets an observational initiation contrast, often called an ITT analogue; it should not be presented as the effect of randomized assignment. Baseline exchangeability, positivity, consistency, adequate measurement, and appropriate handling of loss to follow-up remain necessary.
For a sustained-strategy per-protocol question, specify allowed treatment changes and contraindications as part of the strategy. Estimation must address time-varying confounding and informative deviations, for example with the g-formula or artificial censoring plus appropriate inverse-probability weights. Cloning is useful when a person's data are compatible with multiple strategies at baseline, as with initiation grace periods. It is not required for every sustained-treatment comparison. When baseline initiation identifies one of two strategies, censoring and weighting may be used without cloning. These choices follow the question and data; none guarantees validity by itself.
Pros, cons, and trade-offs
- Versus an ever-versus-never exposure classification: explicit baseline assignment avoids using future survival or treatment to define the baseline groups. A new-user comparison can reduce biases from selecting survivors of earlier treatment. Remaining confounding, selection, and measurement error still need attention.
- Versus an active-comparator new-user (ACNU) design: the approaches are complementary. ACNU can implement a simple target trial of drug initiation. Specifying that trial remains useful even when no cloning or longitudinal weights are needed. More complex sustained or dynamic strategies require additional data and assumptions.
- Versus a randomized trial: existing data may offer longer follow-up or broader coverage with less prospective collection, but treatment is not randomized. A registry-based randomized trial is an actual randomized trial using registry infrastructure, not an observational target-trial emulation. Negative controls and quantitative bias analyses probe selected weaknesses; passing them does not establish absence of bias.
When NOT to use — and when it is actively misleading
- Do not treat an ill-defined contrast such as “the effect of a biomarker level” as an intervention without specifying what changes the biomarker, in whom, and when. Drug, procedure, behavioral, and policy strategies can all be candidates when sufficiently well defined.
- Do not claim identification where a strategy has no support in relevant covariate strata. Restriction changes the target population and must be documented; large weights are not a repair for structural nonpositivity.
- Do not use a “target trial” label to excuse uncertain treatment dates, unmeasured confounding, or eligibility based on future events.
- Do not censor at non-adherence and assume the remaining patients are comparable. Address predictors of both adherence and outcome using a justified method, with diagnostics and sensitivity analysis.
Data-source operational depth
- Claims: confirm medical and pharmacy observability across the lookback. FFS medical claims alone do not give complete Medicare Advantage medical utilization; assess the actual enrollment and encounter files. A paid fill is a dispensing proxy, not proof of ingestion, and continuous coverage does not guarantee capture of cash purchases or outside care. See the payer-observability and medication-reconciliation cards.
- EHR: prescriptions, administrations, and dispensings represent different events. Choose the source that matches the strategy and document date uncertainty. A prescription is not proof of receipt. Define loss to follow-up using a justified observation rule; absence of an encounter alone does not prove either censoring or continued outcome-free observation.
- Registry: assess actual outcome adjudication, exposure history, and mortality completeness. Linkage may help but introduces its own selection and date reconciliation problems.
- Linked data: align order, dispensing, administration, eligibility, and event dates before building the cohort. Assess whether the linkable subset still represents the target population.
Worked claims example — protocol-to-emulation
This is a synthetic design illustration, not a clinical treatment recommendation or validated endpoint algorithm. Question: among eligible adults with type 2 diabetes and stage-3 CKD, what is the difference in three-year MACE risk after initiating an SGLT2 inhibitor versus a DPP-4 inhibitor?
- Eligibility: prespecify age, diabetes and kidney-disease evidence, prior-event rules, calendar dates, and 365 days of observable medical/pharmacy history. Claims CKD codes and measured eGFR are different definitions; justify the chosen phenotype.
- Strategies: initiate one comparator class at baseline after a 365-day washout for both classes. Define simultaneous initiation and previous supply crossing baseline before analysis.
- Assignment: classify from the qualifying initiation record; use pre-treatment confounders to support exchangeability. Same-day records may follow treatment when only dates are available.
- Follow-up and time zero: begin when eligibility and strategy classification coincide. Follow until MACE, non-CV death, loss of observation, data end, or three years. Code non-CV death as a competing event for the absolute MACE-risk question, separately from loss to follow-up.
- Outcome: prespecify and validate MI, stroke, and cardiovascular-death components. If cause of death is unavailable, the proposed MACE endpoint cannot simply be assumed observable.
- Causal contrast: compare initiation strategies regardless of later changes, or separately define sustained adherence. They answer different questions.
- Analysis: for the initiation contrast, estimate standardized or weighted cumulative incidence and a risk difference at the chosen horizon. For sustained strategies, justify a longitudinal g-method; clone only if baseline compatibility requires it. Prespecify confounding, outcome-misclassification, and observation sensitivities.
Decision diagram
flowchart TD Q["Specify the causal question"] --> P["Write all seven<br/>trial-protocol components"] P --> T["Align eligibility, assignment<br/>and follow-up at time zero"] T --> D["Map each component<br/>to observed records"] D --> A["Assess confounding,<br/>positivity and measurement"] A --> E["Choose estimation<br/>for the specified contrast"] E --> R["Report departures from the trial<br/>and remaining uncertainty"]
flowchart TD
Q["Which treatment strategy<br/>is the question about?"] --> I["Initiation, regardless<br/>of later changes"]
Q --> S["Sustained adherence<br/>to a specified strategy"]
I --> B["Baseline confounding adjustment<br/>and follow-up handling"]
S --> C{"Compatible with multiple<br/>strategies at baseline?"}
C -->|Yes| CC["Consider clone-censor-weight"]
C -->|No| G["Longitudinal g-method;<br/>cloning not required"]
CC --> A["Check longitudinal exchangeability,<br/>positivity and measurement"]
G --> A
B --> L["Report the estimand<br/>and assumptions"]
A --> LWorked example
Scenario
Synthetic timing example: Patient 2041 has a first qualifying SGLT2 inhibitor dispensing on 2023-03-01, after a documented 365-day observable washout. A flawed analysis starts follow-up at diabetes diagnosis on 2022-08-15, then retrospectively labels her treated only if she survives AND remains free of the study outcome until that later dispensing. Under that explicit future-event selection rule, it assigns 198 guaranteed outcome-free days to the treated group. A later fill alone does not guarantee freedom from a nonfatal outcome.
Dataset
Key dates for patient 2041 in a commercial claims database, showing both the naive start and the aligned emulation start.
| person_id | event | date | days_since_diagnosis |
|---|---|---|---|
| 2041 | T2D diagnosis (first of 2) | 2022-08-15 | 0 |
| 2041 | T2D diagnosis (second) | 2022-10-02 | 48 |
| 2041 | 365-day washout window opens (no SGLT2/DPP-4 fills) | 2022-03-01 | -167 |
| 2041 | First SGLT2i fill = TIME ZERO (aligned emulation) | 2023-03-01 | 198 |
| 2041 | Naive cohort entry (diagnosis date) | 2022-08-15 | 0 |
| 2041 | Naive treatment classification date (= first fill) | 2023-03-01 | 198 |
Steps
Result
The flawed future-selected group receives 198 guaranteed outcome-free days before initiation. The aligned initiation comparison credits none of those days to exposed follow-up. This removes that specific timing defect; it is not proof of an unbiased treatment effect.
Trade-offs
Code example
Execution not verified · inspect inputs and dependencies before use
Illustrative cohort-construction function for the synthetic initiation question; it does not estimate an effect or implement the complete protocol. Inputs must already contain complete observable pharmacy history and merged enrollment spans. rx: person_id, fill_date (datetime), drug_class.
import pandas as pd
WASHOUT_DAYS = 365
def emulate_target_trial(rx, enroll, elig):
study = (rx.loc[rx["drug_class"].isin(["SGLT2", "DPP4"]),
["person_id", "fill_date", "drug_class"]]
.drop_duplicates().sort_values(["person_id", "fill_date"]))
if study.isna().any().any():
raise ValueError("Study fills require nonmissing patient, date, and drug class")
if elig.duplicated(["person_id", "index_date"]).any():
raise ValueError("Eligibility must be unique per patient and candidate date")
candidates = study.rename(columns={"fill_date": "index_date", "drug_class": "arm"})
single = candidates.groupby(["person_id", "index_date"])["arm"].transform("nunique").eq(1)
candidates = candidates.loc[single].merge(elig, on=["person_id", "index_date"], how="left", validate="many_to_one")
rows = []
selected = set()
for row in candidates.itertuples(index=False):
if row.person_id in selected:
continue
start = row.index_date - pd.Timedelta(days=WASHOUT_DAYS)
prior = study[(study.person_id == row.person_id) &
(study.fill_date >= start) & (study.fill_date < row.index_date)]
spans = enroll[enroll.person_id == row.person_id]
observable = ((spans.enroll_start <= start) & (spans.enroll_end >= row.index_date)
& spans.ma_only.eq(False)).any()
eligible = (pd.notna(row.age) and row.age >= 18 and
pd.notna(row.pre_index_t2d_count) and row.pre_index_t2d_count >= 2 and
pd.notna(row.ckd3_date) and row.ckd3_date < row.index_date)
if prior.empty and observable and eligible:
rows.append((row.person_id, row.arm, row.index_date, start))
selected.add(row.person_id)
return pd.DataFrame(rows, columns=["person_id", "arm", "index_date", "baseline_start"])
Citations
- [1]Hernán MA, Robins JM. Using big data to emulate a target trial when a randomized trial is not available. American Journal of Epidemiology. 2016;183(8):758-764.
- [2]Hernán MA, Sauer BC, Hernández-Díaz S, Platt R, Shrier I. Specifying a target trial prevents immortal time bias and other self-inflicted injuries in observational analyses. Journal of Clinical Epidemiology. 2016;79:70-75.
- [3]Hernán MA, Wang W, Leaf DE. Target trial emulation: a framework for causal inference from observational data. JAMA. 2022;328(24):2446-2447.