- Introduced by
- James M. Robins, Miguel A. Hernán, Babette Brumback (epidemiology); Guanglei Hong & Stephen Raudenbush (education application)
- Year
- 2000 (method); 2006 (canonical education application)
- Type
- Causal inference / weighted regression model
- Family
- Quasi-experimental / causal inference
What does it do?
A marginal structural model (MSM) is a causal model for treatments or exposures that change over time.
It is estimated by inverse probability of treatment weighting, which re-weights observations so that time-varying confounders, including those affected by earlier treatment, no longer distort the comparison. Robins, Hernán and Brumback (2000) introduced MSMs and the associated weighted estimators in epidemiology. Hong and Raudenbush (2006) is a related multilevel causal study in education, but it does not itself apply a time-varying MSM.
The intuition behind the method
In educational settings, students may enter or leave a programme several times, and earlier results or attendance can influence both later participation and later outcomes. Ordinary regression treats these earlier variables as covariates, which can block part of the treatment's effect or bias the estimate when they are themselves affected by earlier treatment. An MSM gives each student-period a weight equal to the inverse of the probability of the treatment actually received, given the observed history. In the weighted sample, the time-varying confounders no longer predict treatment, so a weighted outcome model estimates the average effect of treatment histories across the population.
History
Robins, Hernán and Brumback (2000) introduced marginal structural models and inverse-probability-of-treatment weighted estimators in the journal Epidemiology, motivated by time-dependent confounders that are also affected by earlier treatment. Hong and Raudenbush (2006) is a separate education study of kindergarten retention using multilevel observational data. It applies multilevel propensity score stratification to a single retention decision and models peer effects, so it is best read as a related causal design for education rather than as the origin of MSMs in education research.
When to use it
Choose an MSM when a treatment or exposure is observed at several time points, and the decision to receive it at each point depends on past outcomes or covariates that also predict later outcomes. This requires longitudinal data with repeated measures of treatment, time-varying covariates and the outcome, with covariates measured before each treatment decision. It suits questions about population-average effects of treatment histories rather than single treatment contrasts. Do not use an MSM for cross-sectional data, or when treatment is assigned once at baseline, where propensity-score methods or regression are usually sufficient. Do not use it when important confounders are unmeasured, since weighting cannot correct for them, and do not use it when treatment is randomised, because the weighting is then unnecessary.
Limitations and considerations
- Relies on sequential ignorability: at each time point, all variables that jointly predict treatment and later outcomes must be observed and included in the weight model. Two further assumptions are also required. Positivity means every treatment history has a non-zero probability given the covariates; violations appear as extreme weights. Consistency means the observed outcome equals the potential outcome under the treatment history actually received. The observed data cannot confirm any of these assumptions.
- Estimates depend on the weight model. If the treatment models are misspecified, the weights are wrong and the causal estimate is biased, so model checking and balance diagnostics are required.
- When some students have a very low probability of their observed treatment history, the weights become extreme and the estimates become unstable.
- Interpretation becomes harder as the number of time points and treatment levels grows, because the number of possible treatment histories grows quickly.
- Standard errors must account for the estimated weights. Naive standard errors from a weighted regression, which treat the weights as known, may be incorrect. One valid approach is a nonparametric bootstrap that re-estimates the treatment models and the weighted outcome model in every resample, with the interval taken from the bootstrap variability, as in the worked example in Fundamentals of causal inference using R (p. 220). Clustering of students within classrooms or schools must also be handled explicitly.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Handles time-varying confounding, in which earlier outcomes or covariates both affect later treatment and are themselves affected by earlier treatment. In that situation, conditioning on them in ordinary regression can bias the estimated treatment effect.
- Estimates marginal effects of whole treatment trajectories, so it can compare patterns such as sustained versus intermittent participation rather than a single treatment contrast.
- Once the weights are constructed, the outcome model can be any suitable regression, GEE or survival model fitted to the weighted sample.
- Weight distributions are diagnostic: highly variable or skewed stabilised weights point to weak overlap between treatment histories and warn that the estimates rest on few comparable students.
Applications
- Estimating the cumulative effect of repeated participation in after-school tutoring over several semesters on achievement, where participation depends on prior test scores.
- Evaluating a grade-retention policy in which retention decisions at several grades depend on earlier performance that also predicts later outcomes.
- Assessing how changing special education placement across school years relates to later graduation outcomes.
- Examining the cumulative exposure to varying teacher quality across years on learning growth, where teacher assignment depends on prior student achievement.
- Analysing week-by-week use of educational software in relation to performance, where usage is correlated with earlier results.
How it works
How it works
At each time point, a model estimates the probability that a student receives the treatment, given that student's past treatment and the time-varying covariates observed up to that point, such as prior achievement, attendance or teacher ratings. These probabilities describe how selection into treatment changes over time.
Formula
P(A_t = a_t \mid \bar{A}_{t-1}, \bar{L}_t)Each student's weight is the product, across time points, of the ratio of the marginal probability of the observed treatment history (numerator) to the probability conditional on time-varying covariates (denominator). Using the marginal probability in the numerator gives stabilised weights, which generally have less variance than unstabilised weights.
Formula
W_i = \prod_{t} \frac{P(A_t = a_t \mid \bar{A}_{t-1})}{P(A_t = a_t \mid \bar{A}_{t-1}, \bar{L}_t)}Weighting each observation by its IPW creates a pseudo-population in which the time-varying confounders no longer predict treatment assignment. This removes confounding by measured time-varying covariates, but only if the weight model includes all of them.
A weighted regression, such as a weighted generalised linear model or a weighted GEE, regresses the outcome on the treatment history in the pseudo-population. Because the weights balance measured time-varying confounders, the treatment coefficients can be read as marginal causal effects, subject to the assumptions of the model.
Formula
E[Y(\bar{a})] = \beta_0 + \beta_1 a_1 + \beta_2 a_2 + \cdotsThe estimated coefficient for each treatment term is the marginal causal effect of that treatment pattern on the outcome in the population. For example, a hypothetical comparison of continuous versus intermittent programme participation would be read from the coefficient of the relevant treatment-history term.
Formula
\hat{\psi} = \hat{\beta}_k \text{ (marginal causal effect of treatment } a_k)Common pitfalls
- Using unstabilised weights, which can be extreme and dominate the pseudo-population, inflating the variance.
- Omitting time-varying confounders from the weight model, which violates sequential ignorability and biases the causal estimate.
- Treating good covariate balance as evidence that unmeasured confounding is absent. Balance checks cannot test this assumption.
- Applying an MSM to a single baseline treatment, where propensity-score matching or regression is simpler.
- Ignoring clustering of students within classrooms or schools when computing standard errors.
- Reporting standard errors from a weighted regression that ignores the estimation of the weights.
Frequently asked questions
What is the key assumption behind MSMs?
Sequential ignorability (no unmeasured time-varying confounding): at each time point, conditional on observed past treatment and covariate history, treatment assignment is independent of potential outcomes. This must hold at every occasion, not just at baseline.
How do MSMs differ from propensity-score matching?
Propensity-score matching handles a single, baseline treatment. MSMs extend the idea to treatments that vary over time, constructing weights that account for the entire sequential treatment history and the time-varying covariates that influence it at each step.
What happens if weights are very large?
Extreme weights indicate near-positivity violations: some students had a very low probability of their observed treatment pattern. Stabilised weights, weight trimming, and doubly robust estimators (combining weight and outcome models) are standard remedies.
Do I need special software for MSMs?
An MSM is a multi-step analysis: fit a sequence of treatment models, compute the weights, and then fit a weighted outcome model. Check that the software or code you use can handle time-varying treatment histories rather than a single treatment point, and that its standard errors account for the estimated weights.
Can MSMs handle multilevel education data?
Yes, with caution. Cluster-level confounders, such as school characteristics that affect both treatment and outcomes, must be included in the weight models, because weights that omit them leave confounding in place. After the weights are constructed, a multilevel model or a GEE with clustered standard errors can be fitted in the pseudo-population to account for students nested within classrooms or schools. Random-effects and marginal (GEE) models target different estimands, so the choice should be made deliberately. This multilevel extension is not covered by the 2000 paper and needs separate validation. Hong and Raudenbush (2006) show that school assignment and peer treatments can alter potential outcomes, which makes such checks worthwhile.
Related methods
Sources
Robins, J. M., Hernan, M. A., & Brumback, B. (2000). Marginal structural models and causal inference in epidemiology. Epidemiology, 11(5), 550-560.
Open DOI referenceHong, G., & Raudenbush, S. W. (2006). Evaluating kindergarten retention policy: A case study of causal inference for multilevel observational data. Journal of the American Statistical Association, 101(475), 901-910.
Open DOI referenceFundamentals of causal inference using R, p. 220