Ask Mallard
Analysis method

Inverse probability of treatment weighting (IPTW)

4 min read

IPTW gives more weight to people whose observed treatment was less likely, to estimate an average treatment effect in the eligible population.

Fit

When to use it, and when not to

Use it when

  • You compare two baseline treatments in observational data and want the average effect for all eligible patients.
  • You measured the shared causes of treatment and outcome before treatment began.

Not when

Before you start

What you need

Decide these first
  1. The eligible population and treatment contrastState the outcome, follow-up horizon and whether the target is the full population.
  2. A propensity score for each personThis is the chance of receiving treatment given measured baseline factors.
  3. Weight and balance summariesInspect score distributions, weight tails, effective sample size and weighted differences in baseline factors.
It rests on these
  1. No unmeasured common cause of treatment and outcome remains.How to check: Choose baseline factors using clinical knowledge and a causal diagram, not treatment prediction alone.
  2. Each baseline profile can receive either treatment.How to check: Look for empty treatment groups and scores near the extremes; fitted probabilities cannot prove support.
  3. Treatment versions are well defined, without relevant interference between people.How to check: Align eligibility, treatment assignment and follow-up at time zero.
  4. The treatment model estimates the required probabilities adequately.How to check: Inspect balance, flexible terms and weight sensitivity; good balance cannot test unmeasured confounding.
  5. Missing at random may justify multiple imputation conditional on recorded predictors.How to check: State the assumption; refit weights within each imputed dataset. Explore departures if missingness may depend on unseen values.

Plain language

How it works

Estimate each patient's chance of baseline treatment from measured factors chosen by causal reasoning. This chance is the propensity score. For the full-population effect, weight treated people by one divided by their score. Weight untreated people by one divided by one minus their score. Normalize within each group before subtracting risks or means. Stabilized weights leave separately normalized means unchanged.

Balance and uncertainty

The aim is balance, not accurate treatment prediction. Check weighted means, spreads and overlap before outcomes. Scores near zero or one can yield huge weights; trimming changes the target population. Use a joint estimating-equation sandwich that includes score fitting, or bootstrap the whole analysis. Default weighted-regression errors can be wrong. Baseline IPTW does not handle treatment-confounder feedback over time.

The method in steps
Weights target the full eligible population under the stated assumptions. They do not create randomized treatment.Inverse probability of treatment weighting (IPTW)Define the full eligible populationEstimate baseline treatment chancesInvert the chance of observed treatmentCheck balance and weight tailsCompare normalized weighted outcomesWeights target the full eligible population under the stated assumptions. They do not create randomizedtreatment.
Conceptual diagram. It shows the structure of the idea, not data from any study.
Inputs for the invented example
  • Low baseline risk: 25 treated people, 5 events; 75 controls, 30 events. Treatment score: 0.25.
  • High baseline risk: 75 treated people, 30 events; 25 controls, 15 events. Treatment score: 0.75.

Worked example

A worked example

Invented for illustration
Setting
A cohort compares a baseline treatment with usual care across low and high baseline risk strata.
Question
What is the average difference in fixed-horizon event risk for eligible patients?
Approach
Use the stratum treatment shares as scores. Compute each weighted risk from its weighted events divided by its weighted total.
Result
Weighted event totals are 60 of 200 for treatment and 100 of 200 for control: 30 versus 50 in 100. The difference is -20 per 100.
What it means
These are weighted totals, not extra people. Causal interpretation still needs the stated assumptions; no confidence interval is computed from this summary.

In practice

Recent studies PubMed search · not vetted

Searching PubMed…

Watch out

Common mistakes

The one to remember

IPTW cannot repair unmeasured confounding or a treatment that some patients could never receive. Extreme weights can make a few records dominate.

  • Treating weighted totals as a larger sample.Instead: Weights change contributions, not the number of independent people.
  • Truncating large weights without reporting the change.Instead: Prespecify sensitivity analyses and explain how weight changes affect bias and the target.
  • Using an ordinary binomial interval for a weighted contrast.Instead: Bootstrap people and refit the score and contrast in each sample; use a percentile interval. Resample clusters when required.

Inside Mallard

How Mallard uses this

When a plan names a propensity score or inverse probability of treatment weighting, its propensity cue links to IPTW. The method list also offers distinct matching, overlap-weighting and AIPW options.

Code example in Mallard: An average treatment effect by inverse-probability-of-treatment weighting (iptw-propensity-weights-robust-se).
Atlas node analysis.iptw, the id a plan cue records.
Code for this method
Loading…
Part of the learning path Make a causal claim carefully (step 6 of 7).

Related Learn pages

Related designs and methods

Evidence

Sources & further reading

  1. Marginal structural models and causal inference in epidemiology (opens in a new tab) · Epidemiology · doi 10.1097/00001648-200009000-00011
  2. Constructing inverse probability weights for marginal structural models (opens in a new tab) · Am J Epidemiol · doi 10.1093/aje/kwn164
  3. Moving towards best practice when using inverse probability of treatment weighting (IPTW) using the propensity score to estimate causal treatment effects in observational studies (opens in a new tab) · Stat Med · doi 10.1002/sim.6607
PubMed records checked on 2026-11-07: record verified, confirm it supports this use. Record matching does not establish methodological approval. Examples are invented for illustration.
Last source review: 2026-11-07
AI-generated educational content
Mallard uses reputable methodological and reporting sources, but this material may contain errors or omit important context. Verify important methodological decisions with the cited sources and, when appropriate, a qualified research methodologist or statistician.