Inverse Probability Weighting: A Practical Guide for Researchers

Inverse probability weighting (IPW) is a way to estimate a causal effect from observational data. You model each person’s probability of the exposure they actually received, then weight every person by the inverse of that probability. The weighted sample becomes a pseudo-population in which measured confounders are distributed about equally across exposed and unexposed groups. This guide covers the weights, the assumptions behind them, an R workflow, balance diagnostics, extreme weights, standard errors and censoring weights for survival analysis.
TL;DR
- IPW (also called propensity score weighting or IPTW) reweights your sample so measured confounders no longer predict treatment. It does not fix unmeasured confounding.
- For the average treatment effect (ATE), weights are 1/PS for the exposed and 1/(1−PS) for the unexposed. For the effect on the treated (ATT), treated units get 1 and controls get PS/(1−PS).
- Judge success by balance, not by the propensity model’s fit. Standardized mean differences below 0.1 are the usual benchmark.
- Check weight distributions, truncate or trim if overlap is poor, and use robust or bootstrap standard errors, because the weights are estimated.
- For censored outcomes, inverse probability of censoring weighting (IPCW) applies the same logic to dropout rather than treatment.
Table of Contents
- What inverse probability weighting does
- The weights and the estimand you are targeting
- Assumptions that make the estimate causal
- Implementing IPW in R
- Checking balance: standardized mean differences and more
- Extreme weights and positivity problems
- Standard errors after weighting
- IPW with censored outcomes: IPCW in survival analysis
- A reporting checklist for reviewers
- Perspective
- Run your IPW analysis with a reviewable plan
- FAQ
- Sources
What inverse probability weighting does
In an observational study, people who receive a treatment differ systematically from those who do not. Older patients may be more likely to get a drug, for example, and age also affects the outcome. A raw comparison mixes the treatment effect with that difference.
IPW addresses this by using the inverse probability of the treatment each person actually received. That creates a pseudopopulation in which measured confounders are equally distributed across exposed and unexposed groups (Chesnaye et al., 2021). A treated person who looked unlikely to be treated stands in for many similar people who were not treated, so that person counts for more. A treated person who looked very likely to be treated counts for less.
The contrast with matching is practical. Matching discards units it cannot pair. Weighting keeps everyone and adjusts each unit’s influence. That is why weighting is attractive in smaller clinical datasets, though it brings its own problem: units with very small probabilities can dominate the estimate. We return to that below. If you are weighing matching against weighting for your design, our guide to choosing between matching, weighting, stratification and covariate adjustment sets out the trade-offs.
The weights and the estimand you are targeting
The propensity score (PS) is the probability of receiving treatment given measured covariates, usually estimated with logistic regression. From it you compute weights.
For the ATE, the weights are 1/PS for the exposed and 1/(1−PS) for the unexposed (Chesnaye et al., 2021). For the ATT, treated units get a weight of 1 and controls get PS/(1−PS) (Austin and Stuart, 2015).
| Estimand | Question it answers | Weight, treated | Weight, untreated |
|---|---|---|---|
| ATE | What if everyone in the population were treated versus no one? | 1/PS | 1/(1−PS) |
| ATT | What was the effect among those who were actually treated? | 1 | PS/(1−PS) |
Choose the estimand before you fit anything. A clinician asking whether a therapy helps patients who received it wants the ATT. A policy question about rolling a treatment out to a whole population points to the ATE. The two can differ when effects vary across people. For more on the treated-population estimand, see our practical guide to the treatment effect on the treated.
Assumptions that make the estimate causal
Weights alone do not make an estimate causal. Causal estimates from propensity scores require consistency, exchangeability, positivity and a correctly specified propensity score model (Austin and Stuart, 2015). In plain terms:
- Consistency: the treatment is well defined, so the outcome you observe under a given treatment is the potential outcome for that treatment.
- Exchangeability: once you account for the measured covariates, treated and untreated people are comparable. This is the no-unmeasured-confounding assumption, and no diagnostic can prove it.
- Positivity: every covariate pattern has a nonzero chance of both treatment and no treatment. Violations show up as propensity scores near 0 or 1.
- Correct model specification: the propensity model must be adequate. You test this indirectly, through balance.
Write these in your methods section and say which ones you can defend with design knowledge. A reviewer asking for method justification is usually asking about exchangeability and positivity.
Implementing IPW in R
The logic is three steps: estimate the propensity score, convert it to weights, then fit a weighted outcome model. Here is a minimal ATE example for a binary treatment and outcome.

# 1. Propensity score model
ps_model <- glm(treat ~ age + sex + severity + comorbidity,
data = df, family = binomial)
df$ps <- predict(ps_model, type = "response")
# 2. ATE weights
df$w <- ifelse(df$treat == 1, 1 / df$ps, 1 / (1 - df$ps))
# 3. Weighted outcome model with robust standard errors
library(sandwich); library(lmtest)
fit <- glm(outcome ~ treat, data = df, weights = w,
family = quasibinomial)
coeftest(fit, vcov = vcovHC(fit, type = "HC1"))
For an ATT analysis, swap step 2 for a weight of 1 in treated units and ps/(1 − ps) in controls.
The R package ipw estimates weights for point-treatment and longitudinal studies, and its functions can also be used to correct for informative censoring (ipw README on CRAN). It is useful when treatment varies over time. For a single baseline treatment, the manual approach above is transparent and easy to audit.
Two modeling points are worth keeping in mind. Include covariates that affect the outcome, not just those that predict treatment. And do not use predictive accuracy as the goal for the propensity model. Our guide covers how to estimate a propensity score and avoid common modeling mistakes, and the same advice applies to weighting.
Checking balance: standardized mean differences and more
The weighting step has worked only if the weighted groups look alike on the covariates you adjusted for. Standardized differences are preferred to significance testing for assessing balance, and a value below 0.1 is often used to indicate a well-balanced covariate (Theory and practice of propensity score analysis, 2022). P-values are a poor guide because they depend on sample size (Chesnaye et al., 2021).
The standardized mean difference (SMD) for a continuous covariate is the difference in group means divided by a pooled standard deviation. Because it is unit-free, you can compare age in years with a lab value on a different scale. Compute it before and after weighting, and report both.
A common mistake is to report the c-statistic (AUC) of the propensity model as evidence of success. The c-statistic measures how well the model discriminates exposure groups, not covariate balance (Theory and practice of propensity score analysis, 2022).
In R, the cobalt package reports covariate balance with bal.tab for balance tables and bal.plot for distribution plots (cobalt guide). Balance can be summarized numerically with SMDs, but plots of covariate distributions show what a single number hides, such as a tail that stays imbalanced even when the means agree.
library(cobalt)
bal.tab(treat ~ age + sex + severity + comorbidity,
data = df, weights = df$w,
stats = c("m", "v"), un = TRUE, thresholds = c(m = 0.1))
love.plot(treat ~ age + sex + severity + comorbidity,
data = df, weights = df$w, threshold = 0.1)
Report a table of weighted and unweighted SMDs in your paper. Austin and Stuart note that the rapid growth of IPTW use calls for formal, systematic reporting of balance diagnostics, since many studies they reviewed gave no evidence of covariate balance (Austin and Stuart, 2015). If a covariate stays above your threshold, revisit the propensity model by adding interactions or nonlinear terms, then recheck.

Extreme weights and positivity problems
When a person’s probability of the received treatment is tiny, the weight is huge. A handful of observations can then drive the whole estimate, and the variance explodes.
Low propensity-score overlap can produce extremely large weights, and truncation at the 1st and 99th weight percentiles is typically used (Theory and practice of propensity score analysis, 2022). The same source adds a point worth taking seriously: low overlap means the groups are not comparable, so you may need to reconsider the research question rather than just clip the weights.
A practical routine:
- Plot the propensity score distributions by treatment group and look for regions with no overlap.
- Summarize the weights: minimum, maximum, mean and the top percentiles.
- If a few weights dominate, truncate at a stated percentile, or restrict to the region of overlap, and say so in the methods.
- Rerun the balance check on the truncated weights, since truncation changes balance.
- Report the estimate with and without truncation as a sensitivity analysis.
Stabilized weights, which put the marginal treatment probability in the numerator, are another common approach to reducing variability, particularly in longitudinal settings. Whatever you choose, decide it in advance and record it, because trimming rules chosen after seeing the results invite criticism.
Standard errors after weighting
The naive standard errors from a weighted regression are wrong, because they treat the weights as known. Variance estimation must account for the weighted sample and for the fact that the weights are estimated rather than known; robust sandwich estimators or bootstrap methods can be used (Austin and Stuart, 2015).
The sandwich estimator in the code above is the quick option. The bootstrap is more complete: resample the whole dataset, refit the propensity model, recompute the weights and the outcome model in each resample, and take percentile intervals. Refitting the propensity model inside each resample is the part people skip, and it is the part that captures the uncertainty in the weights. More on this in our collection of robust standard errors articles.
IPW with censored outcomes: IPCW in survival analysis
The same idea handles informative dropout. In inverse probability of censoring weighting (IPCW), you model the probability of remaining uncensored given covariates, then weight uncensored observations by the inverse of that probability. People who resemble those lost to follow-up count more, which compensates for the missing data.
The assumption mirrors the treatment case: censoring must be explainable by measured covariates, and everyone must have a positive probability of remaining under observation. If censoring is plain administrative end of study, ordinary survival methods usually suffice. Our explainer on censoring in survival analysis lists the types.
In R, the ipw package’s functions can be used to correct for informative censoring (ipw README on CRAN), and the riskRegression package uses IPCW to deal with right-censored data (riskRegression documentation). You can combine treatment weights and censoring weights by multiplying them, then fit a weighted Cox model. For related methods, browse our survival analysis articles and IPW estimation articles.
A reporting checklist for reviewers
| Item | What to include |
|---|---|
| Estimand | ATE or ATT, stated before analysis |
| Covariates | Which were in the propensity model and why |
| Model | Functional form, interactions, software and package versions |
| Weights | Distribution summary, truncation rule, stabilization |
| Balance | Weighted and unweighted SMDs, with plots |
| Uncertainty | Robust or bootstrap method, and whether weights were re-estimated |
| Assumptions | Exchangeability and positivity arguments |
This is also what a supervisor needs to reproduce your numbers: a script that goes from raw data to weights to estimate in one pass, with every decision visible.
Perspective
We built PlotStudio AI around a simple observation: the hard part of an IPW analysis is not the formula, it is the chain of decisions around it. Which estimand, which covariates, what truncation rule, what counts as balanced, which variance estimator. Each one is a place where a reviewer can ask “why?” and a supervisor can fail to reproduce your numbers.
That is where agentic analytics for researchers differs from one-shot chat. Specialized AI agents plan the investigation, write and run real code, inspect the intermediate results and synthesize them into a reproducible analysis. With Plan Mode, you review and modify the proposed approach, including the methods and assumptions, before anything executes. Domain Skills can encode how your lab handles weighting and balance reporting, so the next analysis follows the same conventions.
We see PlotStudio AI as an emerging must-have layer in the modern research toolkit, alongside R, RStudio, Python, Stata, SPSS, SAS and Jupyter. Those tools provide the statistical computing. PlotStudio AI adds an agentic layer that can plan, execute, inspect, validate and document a complete analysis, so the methodology, code, outputs and statistics stay available for review.
Aymen
Run your IPW analysis with a reviewable plan
PlotStudio AI is desktop analytics software with privacy-first local data processing, which matters when patient-level data cannot be uploaded to a cloud tool. You can connect a tabular dataset, state your objective, review the plan, and export the completed analysis as a notebook or PDF report.

Plans are listed on the pricing page: Managed Credits at $69.99 per month and Bring Your Own Key at $39.99 per month, plus a free trial. Academic users can take Bring Your Own Key at $399.90 per year on the academic plan page. Groups evaluating a managed deployment can read about the $500 one-off pilot fee on the enterprise page.
FAQ
Is inverse probability weighting the same as propensity score weighting?
In most applied writing, yes. IPW for a binary treatment uses the propensity score to build the weights, so the two names describe the same approach. The related abbreviation IPTW stresses that the weights invert the probability of treatment, as opposed to the probability of censoring in IPCW.
What standardized mean difference counts as good balance?
A value below 0.1 is often used to indicate a well-balanced covariate (Theory and practice of propensity score analysis, 2022). Treat it as a convention rather than a law. Check it on every covariate in the model, and look at distribution plots as well as means.
Should I use IPW or propensity score matching?
It depends on your estimand and your overlap. Weighting keeps all observations and can target either the ATE or the ATT, while matching discards units it cannot pair. Either way, you need a balance table. Our propensity score matching guide covers the matching side.
How do I handle extremely large weights?
Inspect the weight distribution first, then consider truncating at the 1st and 99th percentiles, as is typically done (Theory and practice of propensity score analysis, 2022). If the groups barely overlap, reconsider the research question. Report results with and without truncation.
Can I run IPW in R without writing everything by hand?
Yes. Packages such as ipw and cobalt cover weight estimation and balance reporting. If you prefer to describe the analysis and review a plan first, PlotStudio AI can write and run the R or Python code locally and keep it for review.
Sources
- An introduction to inverse probability of treatment weighting (PMC, 2021)
- Moving towards best practice when using inverse probability of treatment weighting (PMC, 2015)
- Theory and practice of propensity score analysis (PMC, 2022)
- Covariate Balance Tables and Plots: A Guide to the cobalt Package
- ipw package README (CRAN)
- riskRegression package documentation (CRAN)