← Methods repository
CONCEPTADVANCEDPYTHONlast reviewed 2026-10-11 · updated 2026-08-25 · 4 citations

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.

Framework Standardcausal inferencetarget trialprotocol specificationimmortal time preventionestimandper protocolcomparative effectiveness
On this page
Methods reference only. Use primary source citations and local policy before applying this in a study protocol, regulatory submission, payer dossier, or clinical decision.
In plain language

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.

When to use it
—When the aim is an interpretable causal comparison of well-defined strategies.
—Use both for a comparative initiation question; add longitudinal methods when the strategy requires them.
—When a well-defined trial can be mapped credibly to the observed data.
Watch out for
—Requires additional design work; validity still depends on identification and measurement assumptions.
—The framework does not itself choose an estimator or create randomization.
—Unmeasured confounding and incomplete capture can defeat the emulation.

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?

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. Causal contrast: compare initiation strategies regardless of later changes, or separately define sustained adherence. They answer different questions.
  7. 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"]
Protocol specification precedes estimation. Timing alignment and bias assessment have separate jobs; neither the framework nor a propensity score creates randomization.
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 --> L
An initiation contrast and a sustained-strategy contrast are different questions. Cloning addresses baseline compatibility with more than one strategy; sustained treatment alone does not require it.

Worked 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_ideventdatedays_since_diagnosis
2041T2D diagnosis (first of 2)2022-08-150
2041T2D diagnosis (second)2022-10-0248
2041365-day washout window opens (no SGLT2/DPP-4 fills)2022-03-01-167
2041First SGLT2i fill = TIME ZERO (aligned emulation)2023-03-01198
2041Naive cohort entry (diagnosis date)2022-08-150
2041Naive treatment classification date (= first fill)2023-03-01198
FIG. 1 — DESIGN TIMELINE
Timeline from March 2022 to March 2026, including a 365-day washout, diabetes diagnosis, the 198-day diagnosis-to-initiation interval, and follow-up beginning on March 1, 2023.
Synthetic dates. The shaded interval is guaranteed outcome-free only because the flawed design requires survival and no study outcome before future treatment classification. The aligned design begins follow-up at initiation.

Steps

1In the flawed design, membership in the future-treated group requires survival and no study outcome between diagnosis and dispensing. This future eligibility restriction is the source of the guarantee.
2The elapsed interval from 2022-08-15 to 2023-03-01 is 198 days. Counting it as treated follow-up assigns guaranteed outcome-free time to that group.
3If an earlier nonfatal outcome would not prevent later treatment classification, the interval is not automatically immortal with respect to that outcome. Check the classification rules instead of inferring a guarantee from the dates alone.
4In the initiation trial, set time zero to the qualifying first fill, apply eligibility at that point, and follow both treatment groups from their own aligned baseline.
5Do not credit the pre-initiation interval to post-initiation follow-up. Confounding and measurement problems can still bias the aligned comparison.

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

vs. Unspecified observational comparison
Pros of this
—Makes eligibility, time zero, strategies and the causal contrast explicit.
vs. Active comparator new user design
Pros of this
—Provides the protocol specification around the ACNU design.
vs. Randomized trial
Pros of this
—Can use existing records when prospective randomization is infeasible.

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.

requires: pandas
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

FOUNDATIONAL / METHODS
  1. [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. [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. [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.
APPLIED EXAMPLES
  1. [4]Danaei G, Rodríguez LA, Cantero OF, Logan R, Hernán MA. Observational data for comparative effectiveness research: an emulation of randomised trials of statins and primary prevention of coronary heart disease. Statistical Methods in Medical Research. 2013;22(1):70-96.