Medical AtlasPROJECT IMG
✎ Sketch Notes🏛️ 3D LibraryMy Desk

Instrumental variables & difference-in-differences (quasi-experimental designs)

Instrumental variable analysis uses a natural nudge toward treatment to remove unmeasured confounding, estimating a local effect in compliers. Difference-in-differences subtracts the control group change from the treated group change and depends on parallel trends.

Overview

Observational studies of treatments and policies are threatened by confounding, especially unmeasured confounding (e.g., frailty, disease severity, motivation) that regression adjustment and propensity scores cannot fix because they only balance measured variables. Two "quasi-experimental" designs borrowed from econometrics try to mimic randomization:

  • Instrumental variable (IV) analysis: finds a variable (the instrument) that nudges people toward one treatment "as if at random" and uses only that variation to estimate the effect.
  • Difference-in-differences (DiD): compares the before→after change in a group exposed to a policy/intervention with the change in an unexposed group over the same period, cancelling stable group differences and shared time trends.
MethodRemovesKey untestable assumptionEffect estimated
Multivariable regression / propensity scoreMeasured confoundingNo unmeasured confoundersATE or ATT
Instrumental variableMeasured and unmeasured confounding of treatment–outcomeExclusion restrictionLATE (compliers / marginal patients)
Difference-in-differencesTime-invariant group differences + common secular trendsParallel trendsATT (effect in the treated)
Randomized trialAll confounding (by design)Successful randomization, minimal lossATE (ITT)

Mendelian randomization is a special case of IV analysis using genetic variants as instruments.

Instrumental variables: logic & assumptions

An instrument (Z) is a variable that changes the probability of receiving a treatment (X) but has no direct effect on the outcome (Y) and shares no causes with the outcome.

Three core conditions

  • 1. Relevance: Z is associated with treatment X (testable: first-stage strength; a first-stage F-statistic <10 is the classic warning sign of a weak instrument, which biases estimates toward the confounded observational result and inflates variance).
  • 2. Exclusion restriction: Z affects Y only through X (not testable; must be argued).
  • 3. Independence (exchangeability): Z is not associated with unmeasured confounders of X–Y ("as-if random").
  • Monotonicity (needed to interpret as LATE): the instrument pushes everyone in the same direction — no "defiers" who do the opposite of what the instrument encourages.

Common instruments in medicine

InstrumentExampleTypical threat
Distance / differential distance to a facilityLiving closer to a cardiac cath lab → more PCIRural vs urban patients differ in health (independence)
Physician or hospital prescribing preferencePrescriber's prior use of drug A vs BHigh-preference physicians may also differ in overall quality (exclusion)
Calendar time / guideline changeBefore vs after a drug's approval or a label warningOther care changed at the same time
Genetic variants (Mendelian randomization)LDL-lowering alleles → lifelong lower LDLPleiotropy (gene affects outcome by another path)
Randomization itselfAssignment in a trial with crossoverMinimal: random assignment is the ideal instrument

Instrumental variables: estimation & interpretation

  • Two-stage least squares (2SLS): stage 1 regresses treatment on the instrument (plus covariates) to get the predicted probability of treatment; stage 2 regresses the outcome on the predicted treatment. The stage-2 coefficient is the IV estimate.
  • Wald estimator (binary instrument): IV effect = (difference in outcome between instrument groups) ÷ (difference in treatment rates between instrument groups). Example: if hospitals with high-preference rates give drug A to 70% vs 30% (difference 0.40) and mortality is 10% vs 12% (difference −2 points), IV effect ≈ −2/0.40 = −5 percentage points per patient actually treated.
  • This is the same logic as converting an intention-to-treat effect in an RCT with crossover into a complier-average causal effect.

Who does the estimate apply to?

GroupBehaviorContributes to IV estimate?
Compliers ("marginal patients")Get treatment only if the instrument encourages itYes — LATE applies to them
Always-takersTreated regardlessNo
Never-takersUntreated regardlessNo
DefiersDo the oppositeAssumed absent (monotonicity)
  • The local average treatment effect (LATE) may differ from the average effect in the whole population if effects are heterogeneous; two valid instruments can legitimately give different answers because they move different marginal patients.
  • IV estimates have wide confidence intervals (they use only part of the variation in treatment); precision is the price of reduced bias.

Difference-in-differences: design & calculation

DiD compares the change over time in an outcome for a group that receives an exposure (e.g., a state that expands Medicaid, a hospital that adopts a sepsis protocol) with the change in a comparison group that does not.

The 2×2 calculation

BeforeAfterChange
Treated groupABB − A
Control groupCDD − C
DiD estimate(B − A) − (D − C)

Worked example: uninsured rate in expansion states falls 18% → 10% (−8 points); in non-expansion states 20% → 17% (−3 points). DiD = −8 − (−3) = −5 percentage points attributable to expansion. A naive before–after comparison (−8) would wrongly credit the policy with the secular improvement; a naive post-only comparison (10% vs 17%) would be confounded by baseline differences.

  • In regression form: outcome = β0 + β1(treated group) + β2(post period) + β3(treated × post); β3 is the DiD estimate. With many groups/periods this becomes a two-way fixed effects (TWFE) model (group and time fixed effects).
  • The estimand is the average treatment effect on the treated (ATT).
  • Data can be repeated cross-sections or panel data, but the treated group must be observed both before and after.

Difference-in-differences: assumptions, threats & modern fixes

Assumptions

  • Parallel trends: absent the intervention, treated and control groups would have followed the same trend (levels may differ). Not directly testable; supported by similar pre-period trends on an event-study plot.
  • No anticipation: outcomes do not change before the intervention starts (e.g., hospitals preparing early).
  • Stable composition / no spillover: the policy does not change who is in each group or affect the control group (SUTVA).
  • No concurrent shocks affecting only one group at the time of the intervention.

Threats and checks

  • Event-study (leads and lags): pre-period coefficients near zero support parallel trends, but such pre-tests have low power and selective reporting after "passing" distorts inference.
  • Placebo tests: fake intervention dates or an outcome that should not change.
  • Regression to the mean / Ashenfelter dip: groups chosen because of an unusually bad pre-period will improve anyway.
  • Staggered adoption: when groups adopt at different times, classic TWFE can use already-treated units as controls ("forbidden comparisons") and produce negative weights — even a wrong sign when effects grow over time. Modern estimators (Callaway–Sant'Anna, Sun–Abraham, imputation estimators) compare only with not-yet- or never-treated units.
  • Alternatives when trends differ: synthetic control (weighted combination of control units matching the pre-trend), triple differences, interrupted time series with a comparison series.
  • Standard errors should be clustered at the level of the policy (e.g., state).

Choosing a method & reading a paper

SituationBest design
Strong unmeasured confounding by indication; a credible natural "nudge" exists (distance, preference, genotype)Instrumental variable
A policy or program starts at a known time in some groups but not others, with pre- and post-dataDifference-in-differences
Single group, many time points, abrupt changeInterrupted time series
Treatment assigned by a cutoff on a continuous score (e.g., HbA1c ≥6.5%, age 65 Medicare)Regression discontinuity
Confounders are measured wellPropensity score / regression
Question can ethically and feasibly be randomizedRCT

Critical-appraisal checklist

  • IV: Is the instrument strong (F >10, large difference in treatment rates)? Is the exclusion restriction plausible? Are measured covariates balanced across instrument levels (indirect check of independence)? Who are the compliers? Are CIs wide?
  • DiD: Is there a pre-period plot with parallel trends? Was the control group chosen before seeing outcomes? Any coincident policies? Staggered timing handled with modern estimators? Clustered SEs?
  • Both designs give evidence below a well-conducted RCT but above simple adjusted cohort comparisons when assumptions are credible.

🩺 Next best step: classic exam scenarios

  • A cohort study finds that patients given a new anticoagulant have lower mortality, but sicker patients were steered to warfarin. Investigators use each patient's hospital's preference for the new drug → this is an instrumental variable analysis to address unmeasured confounding by indication.
  • Critique of a distance-to-PCI-center IV study: rural patients live farther away and also have different baseline risk → violation of independence; if distance delays all care (not only PCI) → violation of exclusion restriction.
  • Instrument changes treatment rates from 48% to 50% (first-stage F = 3) → weak instrument: biased, imprecise estimate.
  • State A bans menthol cigarettes in 2024; smoking falls 6 points there and 2 points in neighboring states → DiD = −4 points; key assumption = parallel trends.
  • Event-study plot shows the treated hospitals' readmission rates were already falling faster than controls for 3 years before a program started → parallel-trends violation; the DiD estimate is biased.
  • Genetic variants in HMGCR associated with lower LDL also associate with lower CAD risk → Mendelian randomization (IV with genes); main threat = pleiotropy.

🔥 Exam pearls

  • IV fixes unmeasured confounding — the one thing propensity scores cannot do — at the cost of precision and generalizability.
  • IV assumptions: relevance (testable), exclusion restriction, independence (untestable) ± monotonicity.
  • IV estimate = LATE in compliers; Wald ratio = outcome difference ÷ treatment-rate difference.
  • Weak instrument: first-stage F <10.
  • Randomization is the perfect instrument; per-protocol "complier" effects in trials are IV estimates.
  • DiD = (change in treated) − (change in control); key assumption = parallel trends, checked with pre-period data.
  • DiD estimates the ATT; it removes stable baseline differences and shared secular trends.
  • Staggered adoption + TWFE → possible negative weighting; use modern estimators.

Sources: JAMA Guide to Statistics and Methods: Instrumental variables and heterogeneous treatment effects · Callaway: Difference-in-differences for policy evaluation

© 2026 Project IMG · Content from Project IMG labs and atlases · For education only, not medical advice.