Tutorials › Marginal Structural Models › Conditional Balance Within History Strata

Diagnostics and Sensitivity to Misspecification · Tutorial 287 of 501

Conditional Balance Within History Strata

Learn to compare weighted covariate histories within prior-treatment strata, interpret conditional balance, and identify imbalances concealed by marginal summaries.

Advanced 12 min read

What You'll Learn

  • Define history strata for diagnosing treatment balance at a particular time.
  • Derive the weighted conditional treatment distribution under inverse-probability weights.
  • Explain why pooled marginal balance can hide opposite imbalances across history strata.
  • Distinguish balance of a categorical stratifying variable from within-category distributional balance.
  • Compare diagnostics based on conditional balance, pooled summaries, and probability calibration.
  • Identify limitations caused by sparse strata, estimated weights, and unmeasured history.

Why Look Within History Strata?

In longitudinal treatment data, the treatment assigned at time \(t\) may depend on earlier treatment and covariate history. A pooled comparison of the covariates between people who do and do not receive \(A_t=1\) can obscure that dependence: imbalances in different histories may point in opposite directions and cancel in the aggregate. Conditional balance asks a more targeted question: within a selected prior-history stratum, do the weighted treatment groups have comparable distributions of measured pre-treatment covariates?

This is a diagnostic for the treatment weighting at a particular time, not by itself evidence that a causal effect is identified. The probability-calibration material concerns whether fitted treatment probabilities agree with observed frequencies; conditional balance examines the covariate distributions induced by the resulting weights. Neither diagnostic can establish that all relevant confounding has been measured.

Notation and Definition

Let \(A_t\) denote treatment at time \(t\), and let \(H_t\) denote the measured history available immediately before that treatment. It includes prior treatments and the measured covariates observed by time \(t\). Write \(g_t(a\mid H_t)=P(A_t=a\mid H_t)\) for the treatment probability. For a binary treatment, the unstabilized cumulative treatment weight through time \(t\) is

$$ W_t=\prod_{s=0}^{t}\frac{1}{g_s(A_s\mid H_s)}. $$

For a selected stratum, let \(S_t\) be a function of prior treatments and selected measured covariate history, defined without using the current treatment \(A_t\). The stratum may be exact or coarsened; for example, it may fix a prior-treatment pattern and place baseline age into a specified interval. A balance comparison within \(S_t=s\) considers the weighted distributions of pre-\(A_t\) covariates across current treatment groups.

Definition: Conditional weighted balance within history strata means that, within each selected stratum \(S_t=s\), the weighted distributions of specified measured pre-treatment covariates are the same (or sufficiently similar in the sample) for the compared values of \(A_t\). The covariates being compared need not be the variables used to define the stratum. If the exact value of a categorical covariate defines the stratum, its balance cannot be assessed within that stratum; if a continuous covariate is categorized, its category is fixed but its distribution within the category can still be compared.

For a continuous covariate \(X_t\), a mean comparison is only one summary. Distributional comparisons can also use quantiles, empirical cumulative distribution functions, or plots. A small difference in the mean does not guarantee that the distributions are alike.

What the Ideal Weights Do Within a History

The population justification for this diagnostic is an algebraic property of inverse-probability weighting. Suppose treatment takes one of \(K\) possible values, every \(g_t(a\mid h)\) is positive on histories under consideration, and the probabilities used in the weights equal the true conditional probabilities. Conditional on a fixed history \(H_t=h\), earlier factors in \(W_t\) are fixed: they depend on history already observed. The factor for the current treatment cancels its conditional assignment probability.

Theorem: Under the stated positivity and correct-probability assumptions, weighting by \(W_t\) makes the conditional distribution of \(A_t\) given \(H_t=h\) uniform over its \(K\) possible values. Consequently, for any integrable function \(f(H_t)\), its weighted conditional mean is the same in each current-treatment group within a fixed history, whenever those conditional means are defined.

Proof. Conditional on \(H_t=h\), let \(C(h)\) denote the product of the weight factors for times \(s<t\). It is constant across the possible values of \(A_t\) at this fixed history. The original conditional probability of \(A_t=a\) is \(g_t(a\mid h)\), so the unnormalized weighted probability is

$$ g_t(a\mid h)\,C(h)\frac{1}{g_t(a\mid h)}=C(h). $$

This quantity is identical for all \(K\) treatment values. Dividing by the sum over those values, \(K C(h)\), gives weighted conditional probability \(1/K\) for each. Since \(f(H_t)\) is fixed at \(h\), its distribution conditional on that exact history cannot differ across current-treatment groups. More generally, averaging over histories within a stratum yields balance only when the weighting and the conditioning used for the comparison support that conclusion; a coarse stratum can mix histories with different covariate distributions. Thus practical diagnostics compare the covariates across treatment groups within the chosen strata rather than treating this exact-history identity as proof of balance in every coarsened stratum. \(\square\)

Stabilized weights require a related but slightly different interpretation. If their numerator at time \(t\) is \(q_t(A_t\mid A_0,\ldots,A_{t-1})\), then after weighting the conditional treatment distribution is \(q_t(a\mid A_0,\ldots,A_{t-1})\), not necessarily uniform. Because this numerator depends on prior treatment but not on the measured covariate history, the intended diagnostic is often to compare current treatment groups within prior-treatment strata. The expected balance is conditional on that prior treatment history, not necessarily marginal over it.

Worked Example: Inverse Weights Balance a Binary History Covariate

At one treatment time, suppose \(L_t\) is binary and 200 observations are split equally between \(L_t=0\) and \(L_t=1\). Among the 100 observations with \(L_t=0\), 20 receive \(A_t=1\) and 80 receive \(A_t=0\). Among the 100 with \(L_t=1\), 80 receive \(A_t=1\) and 20 receive \(A_t=0\). The true treatment probabilities are therefore \(0.2\) for \(A_t=1\) when \(L_t=0\), and \(0.8\) when \(L_t=1\).

For \(A_t=1\), each observation receives weight \(1/P(A_t=1\mid L_t)\). Within \(L_t=0\), the 20 treated observations each receive weight \(1/0.2=5\), for a weighted total of \(20(5)=100\). Within \(L_t=1\), the 80 treated observations each receive weight \(1/0.8=1.25\), for a weighted total of \(80(1.25)=100\). Thus the weighted \(A_t=1\) group has 100 units of weight in each covariate category.

For \(A_t=0\), the corresponding probabilities are \(0.8\) when \(L_t=0\) and \(0.2\) when \(L_t=1\). The weighted totals are \(80(1/0.8)=100\) for \(L_t=0\) and \(20(1/0.2)=100\) for \(L_t=1\). Therefore both treatment groups have the same weighted distribution of \(L_t\): one half at 0 and one half at 1. In real data the probabilities are estimated, so equality is not guaranteed; this calculation shows the population target of correct inverse-probability weighting.

Marginal Balance Can Conceal Conditional Imbalance

Let \(S\) be a history stratum, \(X\) a covariate, and \(\mu_{as}=E[X\mid A_t=a,S=s]\). The marginal mean difference can be written as

$$ E[X\mid A_t=1]-E[X\mid A_t=0] = \sum_s P(S=s\mid A_t=1)\mu_{1s} - \sum_s P(S=s\mid A_t=0)\mu_{0s}. $$

This expression combines both the within-stratum means and the stratum proportions in each treatment group. Even if the stratum proportions are equal between groups, positive and negative conditional differences can cancel. If the proportions differ, the pooled contrast also reflects that difference in composition.

Worked Example: Opposite Imbalances Cancel in the Pooled Mean

Suppose a prior-treatment history defines two strata, \(S=0\) and \(S=1\). There are 100 observations in each current-treatment group, and within each group 50 observations belong to each stratum. Let \(X\) have the following cell means:

History stratumMean \(X\) if \(A_t=1\)Mean \(X\) if \(A_t=0\)Conditional difference
\(S=0\)202
\(S=1\)02-2

The pooled mean for \(A_t=1\) is \((50(2)+50(0))/100=1\). The pooled mean for \(A_t=0\) is \((50(0)+50(2))/100=1\). The pooled mean difference is \(1-1=0\), even though the conditional differences are \(2\) and \(-2\). A report of marginal mean balance alone would miss a substantial within-history imbalance. The appropriate conclusion is not that the pooled result is useless, but that it answers a different and less targeted question.

Coarsened Strata and What Is Actually Fixed

Stratification makes conditional comparisons interpretable, but the exact information fixed by a stratum must be stated carefully. If a stratum is defined by the exact value of a categorical covariate, that covariate has the same value for everyone in the stratum, so its balance cannot be assessed there. By contrast, if a continuous covariate is divided into ranges, only the range is fixed. The values and distribution within that range may still differ between treatment groups.

Worked Example: A Shared Age Category Does Not Ensure Age Balance

Suppose age is grouped into a single stratum from 40 through 49 years. In that stratum, four treated observations have ages \(48,48,49,49\), while four untreated observations have ages \(40,40,41,41\). All eight observations belong to the same age category. However, the treated mean is \((48+48+49+49)/4=48.5\), and the untreated mean is \((40+40+41+41)/4=40.5\), a difference of \(8\) years. The category is balanced by construction, but the within-category age distribution is not. A diagnostic should therefore compare the finer distribution or a relevant summary of age within the category.

Practical Comparisons and Failure Modes

Conditional balance complements, rather than replaces, pooled balance summaries. A pooled standardized mean difference is concise and useful for an overall comparison, but it can conceal stratum-specific discrepancies. Conversely, exact stratification can become unstable when many strata contain few observations. Probability calibration checks whether fitted probabilities match observed treatment frequencies; a calibrated model can still leave covariate imbalance in the weighted sample, and apparent balance does not by itself demonstrate calibration.

For a categorical covariate whose exact value defines a stratum, do not report its within-stratum balance as evidence: the comparison has fixed it by construction. For a categorized continuous covariate, report that the category is fixed, but inspect within-category values if relevant. More generally, choose strata before comparing current treatment groups, use the same clearly defined stratum rules across groups, and report how many observations and how much total weight each cell contains.

Sparse cells are a warning. A stratum with no observations in one treatment group cannot support a within-stratum comparison; a cell with very few observations may yield highly variable summaries. Large differences in weights can also make nominally large cells effectively depend on only a few observations. Estimated treatment probabilities, model misspecification, and limited overlap can all leave residual conditional imbalance. These diagnostics describe measured covariates and observed histories; they cannot detect imbalance in unmeasured variables.

Common pitfall: “The pooled weighted means agree, so treatment groups are balanced at every time.” This does not follow: conditional differences can cancel across history strata, as in the numerical example. Inspect the relevant weighted comparisons within selected prior-treatment and covariate-history strata, and describe sparse or unsupported cells rather than treating a pooled summary as a substitute.

The most useful report makes the conditioning explicit: name the treatment time, define each history stratum, identify the covariates compared, state whether weights are stabilized, and present both cell-level information and a suitable balance summary. Conditional balance is a diagnostic for the treatment assignment process represented by the measured history and fitted weights; it is not a guarantee of causal validity or of balance on every possible feature.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. Why can equal pooled weighted means fail to show balance within prior-treatment strata?
  2. A categorical covariate defines the exact strata. Can its balance be assessed within those strata? What changes if a continuous covariate is grouped into ranges?
  3. In a binary-treatment model, the true probability of treatment is \(0.25\) in one covariate category. What inverse-probability weight is assigned to treated observations in that category?
  4. What does a history stratum with no observations in one current-treatment group imply for a conditional balance comparison?

Solutions. (1) Pooled means average conditional differences across strata; differences of opposite signs can cancel, and unequal stratum proportions can further affect the pooled contrast. (2) No: the exact categorical value is constant within its stratum. A range fixes only the category, so the continuous values and their distribution within the range can still be compared. (3) The treated weight is \(1/0.25=4\). (4) The within-stratum comparison is unsupported because one treatment group has no observations; do not interpret the absence of a comparison as evidence of balance.

Clinical Biostats