Tutorials › Marginal Structural Models › Balance Across Treatment Histories

Diagnostics and Sensitivity to Misspecification · Tutorial 267 of 501

Balance Across Treatment Histories

Learn to assess whether weighting balances measured covariates across current treatment options within each relevant prior treatment history, and why pooled balance alone can conceal important differences.

Advanced 12 min read

What You'll Learn

  • Define history-specific weighted covariate distributions for sequential treatment decisions.
  • Derive the population balance identity for inverse-probability weighting at a treatment decision.
  • Distinguish within-history balance from pooled balance across histories.
  • Identify how different history mixtures can mask covariate imbalance.
  • Check positivity, weight support, and history-specific effective sample sizes when interpreting diagnostics.

Why Balance Must Respect Treatment History

In longitudinal treatment studies, the relevant comparison changes over time. At decision time \(t\), a person’s current treatment \(A_t\) is assigned after earlier treatments and measured covariates have accrued. A comparison of current treatment options is therefore most informative among people with the same prior treatment history. For example, comparing \(A_t=1\) with \(A_t=0\) among people who all received \(A_{t-1}=1\) answers a different diagnostic question from comparing those options among people who all received \(A_{t-1}=0\).

A pooled balance summary can hide this distinction. Different treatment groups may contain different mixtures of prior treatment histories, and covariate distributions may vary across those histories. This tutorial develops the history-specific comparison and explains what pooled summaries can and cannot establish. It builds on balance diagnostics over follow-up without repeating the general construction of balance summaries.

Definition: Let \(A_t\) be treatment at time \(t\), and let \(\bar A_{t-1}=(A_0,\ldots,A_{t-1})\) be the prior treatment history. Let \(H_t\) denote the measured information available just before \(A_t\), including \(\bar A_{t-1}\) and the measured covariate history up to that time. For a fixed prior treatment path \(\bar a_{t-1}\), history-specific balance means that, after weighting, the distributions of measured pre-treatment covariates are the same across the available values of \(A_t\), within that prior treatment path. It is a diagnostic statement about measured covariates, not a guarantee that unmeasured confounding is absent.

The comparison is conditional on a prior treatment path, not merely on calendar time. A covariate may be balanced between current treatment options within each prior path while the paths themselves have different covariate distributions. Conversely, a pooled covariate summary can look balanced because differences across paths cancel.

The Sequential Weighting Identity

Write \(e_t(a\mid H_t)=P(A_t=a\mid H_t)\) for the conditional probability of current treatment \(a\), given the measured pre-treatment history. Let \(W_{t-1}\) be a nonnegative weight determined by information available before \(A_t\), such as the product of inverse treatment probabilities through the preceding decision. For an unstabilized inverse-probability factor at time \(t\), the current cumulative weight is \(W_t=W_{t-1}/e_t(A_t\mid H_t)\).

The identity below concerns population expectations conditional on a prior treatment path. It requires that this path have positive probability, that the conditional probabilities \(e_t(a\mid H_t)\) be positive wherever the weighted target population has support, and that the displayed expectations be finite. The probability model in the identity is the true conditional treatment probability. A fitted probability substituted for it need not yield the identity.

Theorem: Suppose \(g(H_t)\) is measurable with respect to the pre-treatment history and the expectations below are finite. For any treatment option \(a\) with positive probability on the relevant support, $$ E\left[W_{t-1}\frac{I(A_t=a)}{e_t(a\mid H_t)}g(H_t)\,\middle|\,\bar A_{t-1}=\bar a_{t-1}\right] = E\left[W_{t-1}g(H_t)\,\middle|\,\bar A_{t-1}=\bar a_{t-1}\right]. $$ In particular, the population weighted mean of \(g(H_t)\), defined as the ratio of its weighted numerator expectation to its weighted denominator expectation, is the same for every current treatment option within the fixed prior treatment path, provided the common denominator is positive.

Proof. Conditional on \(H_t\), the values of \(W_{t-1}\) and \(g(H_t)\) are fixed, and \(P(A_t=a\mid H_t)=e_t(a\mid H_t)\). Therefore $$ E\left[\left.\frac{I(A_t=a)}{e_t(a\mid H_t)}\right|H_t\right] =\frac{P(A_t=a\mid H_t)}{e_t(a\mid H_t)}=1. $$ Multiplying by \(W_{t-1}g(H_t)\), taking conditional expectation given the prior treatment path, and using iterated expectation gives the stated identity. Taking \(g=1\) gives the same denominator expectation for every \(a\); taking a general \(g\) gives the same numerator expectation. Their ratio is consequently the same, when the denominator is positive. This is equality of population ratios of expectations; it does not assert equality of the expectations of finite-sample weighted ratios. \(\square\)

A covariate balance check is obtained by choosing \(g\) to be a covariate, an indicator such as \(I(X_t\leq x)\), or a function of several covariates. Indicators recover distributional comparisons, not just mean comparisons. The identity also clarifies the role of the prior weight: within the fixed path, the same \(W_{t-1}\) defines the target distribution for each current treatment option.

Worked Example: A Binary Covariate Within One Prior Path

Among people with a particular prior treatment path, suppose \(P(X=1)=0.4\), and current treatment probabilities are \(P(A_t=1\mid X=1)=0.75\) and \(P(A_t=1\mid X=0)=0.25\). Take \(W_{t-1}=1\). Calculate the weighted distribution of \(X\) for each current treatment option.

For \(A_t=1\), the weighted mass for \(X=1\) is \(0.4(0.75)/0.75=0.4\), and for \(X=0\) it is \(0.6(0.25)/0.25=0.6\). The total weighted mass is \(0.4+0.6=1\), so the weighted proportion with \(X=1\) is \(0.4\).

For \(A_t=0\), the probabilities are \(0.25\) for \(X=1\) and \(0.75\) for \(X=0\). The corresponding weighted masses are \(0.4(0.25)/0.25=0.4\) and \(0.6(0.75)/0.75=0.6\). The total is again \(1\), and the weighted proportion with \(X=1\) is again \(0.4\). Thus the two population weighted distributions agree for this binary covariate in this prior-path stratum.

Why Pooled Balance Is a Different Claim

Suppose a comparison pools people across prior-history strata \(h\). Let \(F_h\) be the covariate distribution in stratum \(h\) after applying the history-specific weighting scheme, and let \(\pi_{a,h}\) be the proportion of the pooled weighted group receiving current treatment \(a\) that comes from stratum \(h\). If within each stratum the weighted covariate distribution is \(F_h\) for every current treatment option, then the pooled distribution for option \(a\) is $$ F_a(x)=\sum_h \pi_{a,h}F_h(x). $$ This expression depends on both the stratum-specific distributions and the treatment group’s mixture of strata.

Result: Given common stratum-specific distributions \(F_h\) across current treatment options, the pooled distributions for options \(a\) and \(b\) are equal exactly when $$ \sum_h \pi_{a,h}F_h(x)=\sum_h \pi_{b,h}F_h(x) $$ for every \(x\). Equal history mixtures guarantee pooled equality. So does a covariate distribution \(F_h\) that is constant across histories. Neither condition is necessary: different mixtures of history-specific distributions can also produce the same pooled distribution.

Proof. By the law of total probability, the covariate distribution in pooled group \(a\) is the mixture of the distribution within each history, weighted by the probability \(\pi_{a,h}\) of that history in group \(a\). Hence its CDF is \(\sum_h\pi_{a,h}F_h(x)\). The same argument gives the expression for group \(b\). The pooled CDFs are equal precisely when these expressions agree at every \(x\), which proves the exact condition. If the mixtures agree, the sums agree. If every \(F_h\) is the same distribution, each sum equals that distribution because the mixture weights sum to one. Those are sufficient conditions, not necessary ones, since distinct weighted sums can coincide. \(\square\)

Worked Example: Different History Mixtures, Identical Pooled Covariate Distribution

Let \(X\) be binary and suppose its probability of being 1 in three prior-history strata is \(0.2\), \(0.5\), and \(0.8\). In current-treatment group 1, suppose the history mixture is one-half from stratum 1 and one-half from stratum 3. In group 0, suppose everyone comes from stratum 2.

The pooled probability of \(X=1\) in group 1 is \(0.5(0.2)+0.5(0.8)=0.1+0.4=0.5\). In group 0 it is \(1(0.5)=0.5\). Because \(X\) is binary, equality of this probability establishes equality of the pooled distributions.

The history mixtures are nevertheless different, and the history-specific distributions vary. The pooled equality arises from cancellation, not from matching the histories. Also, group 0 has no representation from strata 1 and 3, so this example should not be read as evidence of adequate support for comparisons across all histories. It shows why a pooled balance result cannot replace history-specific checks.

Diagnostics and Failure Modes

A useful report presents balance separately for each prior treatment path in which the current treatment options are observed. For each path, compare the weighted covariate distributions across current treatment options. Mean differences can be supplemented with standardized differences, higher-moment summaries, and empirical CDF comparisons. A mean can agree while tails or nonlinear features remain different.

For a binary covariate, a direct check is the weighted proportion in each current option within the stratum. For a continuous covariate, examine weighted means and distributional summaries, including quantiles or CDF differences. Interpret these checks alongside the number of observations and effective sample size in each treatment-by-history cell. A dramatic balance statistic based on a cell with very little effective information is unstable; an empty cell cannot support a within-history comparison.

  • Positivity failure: If an option has zero conditional probability for some histories, its inverse probability is undefined. Near-zero probabilities can create large weights and unreliable stratum-specific summaries.
  • Sparse histories: A long treatment sequence can leave few observations in a particular path. Report the cell counts and effective sample sizes rather than treating every estimated imbalance as equally informative.
  • Pooling hides imbalance: A reassuring overall summary may be driven by different history mixtures or by cancellation among strata. Inspect the strata directly.
  • Incomplete covariate checks: Balance in means alone does not imply balance in distributions. Include distributional or function-specific comparisons when important covariate features may be nonlinear.
  • Interpretation beyond the diagnostic: Balance concerns measured covariates represented in the checks. It cannot verify balance in unmeasured variables or establish the causal assumptions required for an analysis.

History-specific weighted comparisons are the primary diagnostic for the sequential decision at hand. Alternatives answer related but different questions. Stratification alone displays the comparisons clearly but does not create the weighted target distribution. A pooled weighted comparison is compact, but can conceal history composition. Direct standardization can put groups onto a chosen common history distribution; it should be reported as that standardized comparison, not mistaken for the original within-history checks. In all cases, inspect support: no summary can repair a history stratum in which a treatment option is absent.

Worked Example: Balance at a Later Decision With Prior Weights

Within the prior path \(A_1=1\), suppose the unweighted covariate distribution is \(P(X=1)=0.4\). The earlier weight \(W_1\) is 2 when \(X=1\) and 1 when \(X=0\). At the current decision, \(P(A_2=1\mid X=1)=0.75\) and \(P(A_2=1\mid X=0)=0.25\). Find the population weighted proportion with \(X=1\) in each current option using \(W_2=W_1/e_2(A_2\mid H_2)\).

For \(A_2=1\), the weighted mass for \(X=1\) is \(0.4(2)(0.75)/0.75=0.8\), and for \(X=0\) it is \(0.6(1)(0.25)/0.25=0.6\). Thus the total mass is \(1.4\), and the proportion with \(X=1\) is \(0.8/1.4=4/7\).

For \(A_2=0\), the weighted masses are \(0.4(2)(0.25)/0.25=0.8\) for \(X=1\) and \(0.6(1)(0.75)/0.75=0.6\) for \(X=0\). The total is again \(1.4\), giving \(0.8/1.4=4/7\). The common proportion is not the original \(0.4\): it is the mean under the prior-weighted target distribution. This illustrates why the earlier weight must be retained when assessing balance at a later decision.

Common Mistake

A tempting but incorrect argument is: “The expected weighted numerator and denominator are the same across treatment options, so the expected finite-sample weighted means must be the same.” A finite-sample weighted mean is a random ratio. In general, equality of numerator and denominator expectations does not imply equality of expectations of ratios. The valid conclusion here is narrower and precise: the population weighted means defined as ratios of expectations are equal under the stated conditions. Finite-sample weighted summaries can differ because of sampling variation, sparse cells, or estimated treatment probabilities.

Key takeaway: At each sequential treatment decision, assess measured-covariate balance among current treatment options within the same prior treatment history. Treat pooled balance as a separate summary whose equality depends on the mixtures of history-specific distributions.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. What does the sequential weighting identity say about weighted population means within a fixed prior treatment path?
  2. Suppose two current-treatment groups have identical covariate distributions within each history and identical history mixtures. What follows about their pooled covariate distributions?
  3. Give a reason pooled balance does not establish that history-specific distributions are equal.
  4. Why should a balance report include effective sample size or cell counts by treatment and history?

Solutions. (1) For a measurable covariate function \(g\), the ratio of the weighted numerator expectation to the weighted denominator expectation is the same for each current treatment option, provided the probabilities are positive on the relevant support and the expectations are finite. This does not equate expectations of finite-sample ratios. (2) The pooled distributions are equal: they are mixtures of the same history-specific distributions with the same mixture weights. (3) Different history-specific distributions can cancel when mixed; the binary example above gives pooled probability \(0.5\) in both groups despite different history mixtures and varying stratum distributions. (4) Sparse or highly weighted cells provide little stable information, and an absent treatment option makes the within-history comparison unsupported.

Clinical Biostats