New

Now in Claude, ChatGPT, Cursor & more with our MCP server

Back to docs
research-methods11 min read

Marginal Structural Models: Estimating the Effect of a Repeated Feedback-and-Respond Strategy

When a department collects feedback and acts on it term after term, the thing it measures and the thing it does influence each other over time. Marginal structural models use inverse-probability weighting to estimate that cumulative causal effect where ordinary regression is biased.

Koji Education Team

Product

In brief

A marginal structural model (MSM) estimates the causal effect of a treatment that changes over time when a confounder is both affected by past treatment and a cause of future treatment and the outcome - a situation ordinary regression cannot handle without introducing bias. In course evaluation this fits a department that repeatedly collects feedback and acts on it, where student engagement is shaped by earlier responsiveness and in turn shapes later action and outcomes. MSMs fix this with inverse-probability-of-treatment weighting, which builds a pseudo-population in which treatment is unconfounded. The method is powerful but data-hungry, and for a single end-of-term survey it is almost always overkill.

What the research says

The problem MSMs solve was formalized by Robins, Hernán, and Brumback (2000). In longitudinal studies with a time-varying treatment, the standard response to confounding - adjust for the confounder in a regression - breaks down when a confounder is simultaneously affected by earlier treatment and a predictor of later treatment and the outcome. Such a variable is a confounder for later treatment but a mediator for earlier treatment. Adjust for it and you block part of the causal path you are trying to estimate and can open a collider; leave it out and residual confounding remains. There is no single regression that is correct for every time point at once.

Robins and colleagues proposed a different strategy: a marginal structural model for the counterfactual outcome under each possible treatment history, with parameters estimated by inverse-probability-of-treatment weighting (IPTW). Each person-time observation is weighted by the inverse of the probability of receiving the treatment they actually received, given their measured history. The weighting creates a pseudo-population in which, by construction, treatment at each wave is independent of the measured time-varying confounders, so a simple weighted model recovers the causal effect without conditioning on the mediator-confounder.

Cole and Hernán (2008) turned this into practical guidance, showing how to build and diagnose the weights: use stabilized weights to control variance, examine the weight distribution for extreme values, and check that the mean of the stabilized weights is near one as a model-specification diagnostic. Petersen, Porter, Gruber, Wang, and van der Laan (2012) gave the method its most important health warning by dissecting the positivity assumption - the requirement that every covariate pattern have a non-zero probability of each treatment level. When positivity is violated or nearly violated, weights explode, estimates become unstable and model-dependent, and the method can mislead. The comprehensive modern treatment is the open-access text by Hernán and Robins (2020), Causal Inference: What If.

Why it matters for course evaluation in practice

Most course-evaluation analysis is cross-sectional: one survey, one cohort, one comparison. But quality assurance increasingly runs as a loop - collect feedback mid-term, act on it, collect again, act again - and the loop is precisely where time-varying confounding appears.

Consider a department estimating whether a sustained respond-to-feedback strategy over several terms improves end-of-programme outcomes. Student engagement is the troublesome variable. Early responsiveness raises engagement; engagement makes students more likely to respond to and benefit from later interventions; and engagement also predicts the outcome. Engagement is therefore caused by past treatment and is a cause of future treatment and the outcome - the exact structure Robins described. A fixed-effects or lagged panel regression that controls for engagement at each wave will partial out part of the very effect of early responsiveness that runs through engagement. Controlling for a variable on the causal path is the collider and mediator trap that causal diagrams are designed to expose.

MSMs give a principled alternative that complements the cross-sectional toolkit - propensity-score matching, entropy balancing, and difference-in-differences - none of which is built for a confounder that is itself a downstream effect of earlier treatment.

A worked example

A faculty runs three feedback waves across a year. After wave one, programmes with poor feedback receive a teaching-support intervention. Intervention uptake at wave two depends on wave-one engagement, which was itself lifted by the wave-one response; the same engagement predicts final satisfaction. The question is the cumulative effect of being on the intervention track across all three waves.

The naive analysis regresses final satisfaction on cumulative intervention, adjusting for engagement measured at each wave. It returns a disappointingly small effect - because adjusting for wave-two engagement removed the part of the wave-one intervention effect that worked by raising engagement. The MSM analysis instead models the probability of receiving the intervention at each wave given prior engagement and history, forms stabilized inverse-probability weights, checks that their mean is near one and that no handful of programmes carry enormous weight, and fits a weighted model of final satisfaction on cumulative intervention. The weighted estimate is larger and is the one that answers the causal question, because the weighting handled engagement as a time-varying confounder without conditioning away the mediated effect. If a few programmes had near-deterministic treatment - say, every low-engagement programme always got the intervention - positivity would be threatened and the whole estimate would deserve a scepticism it does not need in the clean case.

Limitations and honest caveats

MSMs are not a routine tool, and overselling them would be a disservice. The first limitation is data: the method needs the time-varying confounders measured richly and repeatedly at every wave, with time-stamped treatment and outcome. Most evaluation systems do not collect this, and an MSM fitted on sparse or poorly measured confounders simply launders residual confounding through a weighting step. Second, positivity is a genuine and common failure mode; when some covariate patterns almost always receive the same treatment, stabilized weights blow up and estimates become model-dependent and fragile, as Petersen and colleagues detail. Third, like every method in this family, MSMs rest on no unmeasured confounding, which is untestable and often implausible in observational education data, and on correct specification of the weight model. Fourth, sample sizes in a single department are frequently too small for stable weights across several waves. Finally, the estimand is a population-average effect of a treatment strategy, which may not match the programme-specific question a committee actually has. The honest positioning is that an MSM is the right tool for a well-instrumented longitudinal programme asking a cumulative-effect question, and the wrong tool for a one-shot end-of-term survey, where simpler designs are more credible.

How Koji incorporates this

Koji does not run causal inference for you, and it would be wrong to imply that collecting feedback through Koji makes an effect causal. What Koji provides is the data substrate that makes an analysis like an MSM feasible rather than impossible, together with honesty about its assumptions.

  • Repeated, time-stamped collection. Koji is built for mid-cycle and longitudinal feedback, not only end-of-term snapshots, so the repeated-measures structure an MSM requires can actually exist in the data.
  • Measuring the time-varying confounders. The AI-moderated conversational interview and structured questions capture engagement, sentiment, and experience at each wave, giving the weight model real covariates to work with instead of a thin proxy.
  • Recording the treatment history. Closing-the-loop action tracking records what a department did and when - the time-varying treatment - so the exposure can be defined wave by wave rather than guessed.
  • Better-measured inputs. Quality scoring and careless-response detection improve the measurement of both outcomes and confounders, which matters because an MSM is only as good as the variables fed into its weights.
  • Honest reporting. Koji frames multi-wave summaries as descriptive unless a defensible causal design is in place, and supports the distribution and diagnostic views an analyst needs to judge positivity and weight stability.

Koji is designed to make rigorous longitudinal analysis possible and to resist overclaiming, not to manufacture causal estimates from observational feedback. The same engine powers longitudinal product and customer research at koji.so, where repeated, well-measured waves are likewise the precondition for any credible claim about what an intervention actually caused.

Frequently asked questions

What is a marginal structural model?

It is a model for the counterfactual outcome under each possible history of a time-varying treatment, whose parameters are estimated by inverse-probability-of-treatment weighting rather than by regression adjustment. It is marginal because it targets the population-average effect of the treatment strategy, and structural because its parameters are defined in terms of counterfactual outcomes.

What is time-varying confounding and why does standard regression fail?

Time-varying confounding arises when a confounder is both affected by earlier treatment and a cause of later treatment and the outcome. Such a variable is a confounder for later treatment but a mediator for earlier treatment, so adjusting for it in a regression blocks part of the effect you want and can open a collider, while not adjusting leaves confounding. No single regression is correct for all time points at once.

How does inverse probability weighting fix the problem?

Each observation is weighted by the inverse of the probability of the treatment actually received, given measured history. This builds a pseudo-population in which treatment at each wave is independent of the measured time-varying confounders, so a simple weighted model recovers the causal effect without conditioning on the mediator-confounder. Stabilized weights are used to keep the variance manageable.

When would a course-evaluation program actually need an MSM?

When it runs a genuine feedback loop over several waves - collect, act, collect, act - and wants the cumulative effect of a sustained respond-to-feedback strategy, with a confounder such as engagement that is shaped by earlier responses and shapes later ones. For a single cross-sectional survey, an MSM is unnecessary and simpler designs are more credible.

What are the main assumptions and how can they fail?

The key assumptions are no unmeasured confounding, correct specification of the weight model, and positivity - every covariate pattern must have a non-zero chance of each treatment level. Positivity fails when some patterns almost always get the same treatment, which makes weights explode and estimates unstable. No unmeasured confounding is untestable and often implausible in observational education data.

Is this overkill for most course evaluations?

Usually yes. MSMs need rich, repeated measurement of confounders, time-stamped treatment and outcomes, and adequate sample sizes - conditions most evaluation systems do not meet. They are the right tool for a well-instrumented longitudinal program asking a cumulative-effect question, and the wrong tool for a routine end-of-term form, where a simpler and more transparent analysis is more defensible.

References

  • Robins, J. M., Hernán, M. A., & Brumback, B. (2000). Marginal structural models and causal inference in epidemiology. Epidemiology, 11(5), 550-560. doi:10.1097/00001648-200009000-00011
  • Cole, S. R., & Hernán, M. A. (2008). Constructing inverse probability weights for marginal structural models. American Journal of Epidemiology, 168(6), 656-664. doi:10.1093/aje/kwn164
  • Petersen, M. L., Porter, K. E., Gruber, S., Wang, Y., & van der Laan, M. J. (2012). Diagnosing and responding to violations in the positivity assumption. Statistical Methods in Medical Research, 21(1), 31-54. doi:10.1177/0962280210386207
  • Hernán, M. A., & Robins, J. M. (2020). Causal Inference: What If. Chapman & Hall/CRC. (Open-access text)

Related resources

Related articles