- Introduced by
- Robins, Hernán & Brumback; robustness extensions by Scharfstein, Rotnitzky, Lunceford & Davidian
- Year
- 2000–2004
- Type
- Causal inference / weighted regression
- Family
- Quasi-experimental / causal inference
What does it do?
Robust marginal structural models (robust MSMs) extend the standard marginal structural model (MSM), which uses inverse probability of treatment weighting (IPTW) to handle time-varying confounding affected by earlier treatment.
Robustness is added in one of two distinct ways. Sandwich (robust) standard errors protect the variance estimate under some misspecification, but they do not change the point estimate. Doubly-robust augmented estimators add an outcome-model correction to the weighted estimate, and only these have the property that the point estimate is consistent if either the weight model or the outcome model is correct.
The intuition behind the method
A standard MSM reweights observations so that treatment at each time point no longer depends on the time-varying confounders recorded in the data, creating a pseudo-population in which the treatment-outcome comparison is less confounded. The outcome model fitted in that pseudo-population is still a modelling choice, and its form may be imperfect. A sandwich variance estimator adjusts the standard errors so that they remain appropriate when the variance structure assumed by the model is wrong, which gives more honest confidence intervals. It does not, by itself, correct a biased point estimate. Doubly-robust augmentation changes the point estimate itself, so that it is consistent if either the weight model or the outcome model is correctly specified. Sandwich errors therefore address inference, while augmentation addresses estimation.
History
Marginal structural models and the inverse-probability-of-treatment weighted estimators used to fit them were introduced by Robins, Hernán and Brumback in a 2000 paper in Epidemiology. Sandwich variance estimation and doubly-robust augmented estimators were later developed in the causal inference literature as robust variants of this approach.
When to use it
Use a robust MSM when the goal is to estimate the causal effect of a time-varying treatment or exposure on a longitudinal outcome, and when time-varying covariates both predict later treatment and are affected by earlier treatment, so that standard regression adjustment is biased. Observational cohort, electronic health record, and panel data with sequential treatment are typical settings. Prefer sandwich standard errors over model-based standard errors whenever the outcome model form is uncertain, and consider doubly-robust augmentation when the weight model is also uncertain. Do not use the method when treatment was randomised and no confounding adjustment is needed, when exposure is measured once and cross-sectional adjustment is sufficient, or when positivity is severely violated, since near-zero treatment probabilities produce very large weights that no variance correction resolves. Before use, check the key assumptions: sequential exchangeability given measured time-varying covariates, positivity for the treatment histories in the population, consistency of the treatment definition, and correct specification of the treatment and outcome models.
Limitations and considerations
- Requires a correctly fitted treatment (weight) model at each time point; poor estimation can produce bias that the sandwich variance does not correct.
- The positivity assumption is demanding: if some covariate histories make a treatment nearly certain or nearly impossible, the weights become extreme and the estimate becomes unstable.
- The sandwich correction changes only the standard errors. Bias in the point estimate from misspecified weights or outcome models remains unless doubly-robust augmentation is used.
- Identification relies on sequential exchangeability: all time-varying confounders of treatment and outcome must be measured. Unmeasured time-varying confounding biases the estimate, and no weighting or variance correction removes it.
- Implementation is more involved than cross-sectional propensity weighting, and requires software that handles longitudinal weights and cluster-robust variances. The choice of software does not change the estimand.
- Asymptotic justification of the sandwich variance and of doubly-robust estimators depends on large samples; performance with small samples and many time points is not guaranteed.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Addresses time-varying confounding that is itself affected by earlier treatment, a situation in which conventional regression adjustment for those covariates is biased.
- Sandwich standard errors give inference that remains appropriate under some misspecification of the variance model, which is common when the outcome model is only approximate.
- Doubly-robust augmentation gives a consistent point estimate if either the weight model or the outcome model is correctly specified, though not necessarily both.
- Stabilized weights reduce the influence of extreme observations compared with unstabilized weights, which typically improves finite-sample behaviour.
- Produces marginal (population-average) causal contrasts rather than conditional effects, which suits population-level questions.
- Can be applied to binary, categorical or continuous time-varying treatments, subject to the usual positivity and model requirements.
Applications
- Estimating the effect of time-varying antiretroviral therapy regimes on disease progression in cohort data, the setting in which MSMs were first developed.
- Evaluating sequential policy or programme exposures on long-run outcomes in panel data, where uptake and confounders both change over time.
- Assessing cumulative medication adherence on chronic disease outcomes in electronic health record studies.
- Analysing repeated workplace interventions and injury rates in longitudinal employer data.
- Studying dose-response relationships for occupational or environmental exposures measured at several time points.
How it works
How it works
For each unit, the unstabilized inverse-probability-of-treatment weight is the product over time points of the inverse probability of the observed treatment, given treatment history and time-varying covariate history. Because the denominator conditions on the time-varying confounders, weighting removes their association with treatment in the pseudo-population. These weights have no numerator and can be highly variable.
Formula
\hat{w}_{it} = \prod_{k=1}^{t} \frac{1}{P(A_k = a_k \mid \bar{A}_{k-1}, \bar{L}_{k-1})}The stabilized weight multiplies the inverse probability by a numerator: the probability of the observed treatment given treatment history alone. The denominator is the same as in the unstabilized weight. Stabilization keeps the mean weight close to one and reduces variance relative to unstabilized weights. The numerator model must condition only on treatment history (and baseline covariates, if the MSM includes them), not on time-varying confounders.
Formula
\hat{sw}_{it} = \prod_{k=1}^{t} \frac{P(A_k = a_k \mid \bar{A}_{k-1})}{P(A_k = a_k \mid \bar{A}_{k-1}, \bar{L}_{k-1})}Fit a weighted regression of the outcome on the treatment history in the pseudo-population defined by the stabilized weights, using the identity link in the displayed formula. The MSM models the expected potential outcome under treatment history abar. In the displayed formula, treatment enters through a summary of that history (for example, cumulative treatment), and the coefficients are estimated by weighted least squares with the stabilized weights. The coefficients summarise the marginal effect of treatment averaged over the population. If doubly-robust augmentation is used, an outcome-model term is added to the weighted estimator.
Formula
E[Y^{\bar{a}}] = \beta_0 + \beta_1 A + \beta_2 tReplace the model-based variance with a sandwich (Huber-White) estimator. The bread is (X'WX)^{-1}. The meat is the sum over units of the weighted score contributions, where each unit's weighted residual score is X_i' W_i u_i. Because the same unit contributes repeated measurements, use the cluster-robust version, clustering on the unit. This gives standard errors and confidence intervals that remain valid under some misspecification of the variance model. The sandwich estimator does not make a biased point estimate consistent. That property depends on the weights and, where used, the augmentation term.
Formula
\widehat{\text{Var}}(\hat{\beta}) = (X^\top W X)^{-1} \left(\sum_i X_i^\top W_i \hat{u}_i \hat{u}_i^\top W_i X_i\right) (X^\top W X)^{-1}Common pitfalls
- Using unstabilized or untruncated weights, which allows a few extreme weights to dominate the pseudo-population and inflate variance.
- Failing to inspect the weight distribution. Very large maximum weights relative to the mean signal positivity problems. Truncation or a revised weight model can be tried as a sensitivity analysis, and results should be reported with and without truncation.
- Reporting model-based standard errors when the outcome model is plausibly misspecified, or ignoring that repeated measures on the same unit require cluster-robust standard errors.
- Ignoring informative censoring. If subjects leave the study in ways related to their treatment and covariates, a separate censoring-weight model is needed alongside the treatment-weight model.
- Treating the weighting as a substitute for randomisation. Weighting adjusts only for confounders that were measured and correctly modelled; unmeasured confounding remains a threat to the causal interpretation.
- Including time-varying confounders in the numerator model of the stabilized weights, which defeats the purpose of stabilization and can bias the estimate.
Frequently asked questions
What makes this model 'robust' compared to a standard MSM?
A standard MSM typically reports model-based standard errors, which assume the outcome model's variance structure is correct. A robust MSM replaces them with sandwich (Huber-White) standard errors, which stay appropriate under some misspecification. Doubly-robust augmentation goes further: it changes the point estimate so that it is consistent if either the weight model or the outcome model is correct. This either-or property holds only for augmented estimators, not for sandwich standard errors alone.
When should I truncate the stabilized weights?
Truncation is considered when a small number of weights are very large relative to the rest of the sample, which is a sign of positivity problems. Trimming the extreme tail reduces variance but introduces some bias, so it is a trade-off. There is no universal threshold: treat truncation as a sensitivity analysis, and report the weight distribution and the estimates with and without truncation, along with the number of observations affected.
What is the positivity assumption and why does it matter?
Positivity requires that every covariate history that occurs in the population has a non-zero probability of each treatment level at each time point. When this fails for some histories, the corresponding weights become very large or undefined, and the estimate is dominated by a few observations. No choice of variance estimator fixes this; the design or the target population may need to change.
How does a robust MSM differ from doubly-robust estimation?
Doubly-robust estimation (augmented IPTW) is one specific robustness strategy. It adds an outcome-regression correction to the IPW estimator, so the point estimate is consistent if either model is correct. Using sandwich standard errors alone is a simpler strategy: it protects inference under some misspecification but does not make a misspecified point estimate consistent.
Can I use robust MSMs with binary or count outcomes?
The weighted outcome model can be a generalised linear model, such as logistic or Poisson regression, and the sandwich variance applies in the same way. For binary outcomes, the choice of link determines whether the coefficient is interpreted as a marginal risk ratio, a risk difference or an odds ratio, so the link should match the causal estimand of interest. The mechanics formula in this page is written on the identity scale.
Related methods
Sources
Robins, J. M., Hernán, M. A., & Brumback, B. (2000). Marginal structural models and causal inference in epidemiology. Epidemiology, 11(5), 550-560.
Open DOI referenceHernán, M. A., & Robins, J. M. (2020). Causal Inference: What If. Chapman & Hall/CRC.
Open publication reference