Tutorials › Marginal Structural Models › Time Structure Misspecification in Treatment Models

Diagnostics and Sensitivity to Misspecification · Tutorial 274 of 501

Time Structure Misspecification in Treatment Models

Use period-specific calibration, balance, and weight checks to identify when a treatment model fails to represent changes in assignment over follow-up.

Advanced 12 min read

What You'll Learn

  • Define period-specific treatment probabilities conditional on the observed history.
  • Check whether calibration errors cancel in pooled summaries but persist by period.
  • Derive how correct inverse-probability weighting balances covariate histories.
  • Calculate the balance distortions caused by misspecified period-specific probabilities.
  • Separate incremental weight problems from cumulative weight problems.
  • Recognize what these diagnostics cannot establish about causal validity.

Why Time Structure Needs Its Own Checks

In a longitudinal study, treatment assignment can change as follow-up proceeds. Clinical guidelines may change, patients may become eligible for treatment, and clinicians may respond differently to evolving covariate histories. A treatment model that represents covariates adequately but represents time inadequately can therefore produce probabilities that are wrong in a systematic, period-dependent way.

The problem is not necessarily visible in a pooled fit summary. Overprediction in one period can cancel underprediction in another, and an overall balance statistic can conceal a failure at a particular treatment decision. The useful diagnostic question is therefore: does the model represent assignment adequately at each relevant time, for the histories observed at that time?

Definition: For individual \(i\) at period \(t\), let \(A_{it}\in\{0,1\}\) denote treatment, let \(L_{it}\) denote measured covariates available at that decision, and let \(H_{it}=(\bar L_{it},\bar A_{i,t-1})\) denote the observed history used to model treatment. The treatment probability is \(p_t(H_{it})=P(A_{it}=1\mid H_{it})\). A time-structure misspecification occurs when the fitted model does not adequately represent how this conditional probability varies with \(t\), including changes over time or time-varying relationships between history and treatment.

For a binary treatment, the period-specific inverse-probability factor is \(1/\hat p_{it}\) for a treated person and \(1/(1-\hat p_{it})\) for an untreated person, where \(\hat p_{it}\) is the fitted probability. The denominator part of an unstabilized longitudinal weight through period \(t\) is the product of these factors over periods \(1,\ldots,t\). Stabilized weights also have numerator factors; for diagnosing the treatment model, it is useful to inspect the denominator probabilities and incremental factors as well as the resulting weights.

Three Complementary Views of Time Misfit

A period-specific calibration check compares fitted probabilities with observed treatment frequencies separately by period. It can be done in bins of predicted probability or within prespecified history groups, provided each group has enough observations for a meaningful comparison. A balance check asks whether covariates at a treatment decision remain associated with current treatment after applying the appropriate weights, ideally within relevant prior-treatment histories. A weight check examines the distribution of the period’s inverse-probability factors and of the cumulative product.

These checks answer different questions. Calibration assesses whether predicted probabilities agree with observed frequencies; balance assesses a consequence of weighting for measured covariates; weight distributions reveal how strongly the fitted probabilities amplify particular observations. Agreement on one view does not guarantee agreement on the others. In particular, a model can have an acceptable overall calibration summary and still have period-specific errors.

Worked Example: Opposing Calibration Errors Across Two Periods

Suppose there are 100 treatment decisions in each of two periods. In period 1, 20 people receive treatment; in period 2, 80 do. A fitted model predicts a treatment probability of \(0.50\) for every decision in both periods.

In period 1, the observed treatment frequency is \(20/100=0.20\), so the model overpredicts by \(0.50-0.20=0.30\). In period 2, the observed frequency is \(80/100=0.80\), so it underpredicts by \(0.50-0.80=-0.30\). Across the 200 decisions, the observed frequency is \((20+80)/200=0.50\), exactly equal to the average fitted probability. The pooled calibration error is zero even though both period-specific errors are large.

The weighting consequences are also period-dependent. In period 1, each treated decision receives factor \(1/0.50=2\), and each untreated decision receives factor \(1/(1-0.50)=2\). The weighted treated and untreated totals are therefore \(20(2)=40\) and \(80(2)=160\), respectively. In period 2 they are \(80(2)=160\) and \(20(2)=40\). The weighted treatment shares remain \(40/(40+160)=0.20\) and \(160/(160+40)=0.80\).

Thus, pooled predicted and observed frequencies agree, but period-specific calibration and weighted treatment frequencies reveal that the constant prediction does not represent the changing assignment pattern. This example concerns treatment frequency over time; covariate balance must still be checked with the relevant histories and covariates.

Why Correct Period-Specific Weights Balance Histories

The following population identity explains why balance is a useful diagnostic. It concerns one treatment decision and the history \(H_t\) used to model it. Assume binary treatment, a correctly specified conditional probability \(p_t(H_t)\), and positivity: \(0<p_t(H_t)<1\) for histories under consideration. Assume the relevant expectations exist. Weight treated observations by \(1/p_t(H_t)\) and untreated observations by \(1/\{1-p_t(H_t)\}\).

Theorem: Under these conditions, the normalized weighted distribution of \(H_t\) is the same in the treated and untreated groups. Equivalently, for any bounded measurable function \(g\), its weighted mean of \(g(H_t)\) is \(E[g(H_t)]\) in either group.

To prove the result, condition on \(H_t\). For treated observations,

$$ E\left[\frac{I(A_t=1)g(H_t)}{p_t(H_t)}\right] = E\left[ g(H_t)\frac{E\{I(A_t=1)\mid H_t\}}{p_t(H_t)} \right] = E[g(H_t)]. $$

Here \(E\{I(A_t=1)\mid H_t\}=p_t(H_t)\), so the conditional probability cancels. Setting \(g(H_t)=1\) shows that the expected treated weight is 1. Dividing the displayed identity by this normalizing expectation gives the normalized weighted mean \(E[g(H_t)]\).

For untreated observations, the same calculation gives

$$ E\left[\frac{I(A_t=0)g(H_t)}{1-p_t(H_t)}\right] = E\left[ g(H_t)\frac{E\{I(A_t=0)\mid H_t\}}{1-p_t(H_t)} \right] = E[g(H_t)], $$

because \(E\{I(A_t=0)\mid H_t\}=1-p_t(H_t)\). The normalizing expectation is again 1. Thus both weighted groups have the same distribution of \(H_t\), as asserted. In finite samples with estimated probabilities, balance is not guaranteed to be exact; residual imbalance may reflect sampling variability, estimation error, or misspecification. \(\square\)

This identity motivates checking balance in the histories that enter the assignment model, rather than relying only on an overall balance summary. In a longitudinal analysis, prior treatment can define distinct risk sets or history strata, and the period’s treatment decision must be interpreted in that context. A failed balance check is evidence that the chosen weighting procedure has not removed the measured association being assessed; it is not, by itself, proof of which model component is wrong.

Worked Example: Correcting Weighted Masses Under a Misspecified Period Model

At period 2, suppose the observed counts are as follows. Among people with \(L=0\), 50 receive treatment and 50 do not. Among people with \(L=1\), 90 receive treatment and 10 do not. A fitted treatment model predicts \(0.30\) when \(L=0\) and \(0.70\) when \(L=1\), although the observed treatment frequencies are \(0.50\) and \(0.90\).

For treated people, the inverse-probability weighted masses are \(50/0.30=500/3\) for \(L=0\) and \(90/0.70=900/7\) for \(L=1\). The total is \(500/3+900/7=6200/21\). The weighted proportion with \(L=1\) is therefore

$$ \frac{900/7}{500/3+900/7} = \frac{2700}{6200} = \frac{27}{62} \approx 0.4355. $$

For untreated people, the corresponding masses are \(50/(1-0.30)=500/7\) for \(L=0\) and \(10/(1-0.70)=100/3\) for \(L=1\). Their total is \(500/7+100/3=2200/21\), so their weighted proportion with \(L=1\) is

$$ \frac{100/3}{500/7+100/3} = \frac{700}{2200} = \frac{7}{22} \approx 0.3182. $$

The weighted proportions differ by approximately \(0.4355-0.3182=0.1173\). The fitted probabilities have not removed the association between \(L\) and treatment in this period. The weighted masses above use the actual counts; dividing all counts by 100 would instead produce masses on a common rescaled scale, not the stated raw weighted totals.

Inspecting Incremental and Cumulative Weights

A large cumulative weight can arise from several moderately large factors, one near-violated positivity condition, or both. Conversely, a cumulative distribution can make it difficult to locate the period that contributes most to the problem. For that reason, inspect the distribution of each period’s factor by period and treatment status, and then inspect cumulative weights as a separate summary. Relevant features include quantiles, maxima, skewness, and the proportion of factors or weights above a prespecified threshold. These are descriptive warnings, not universal pass-or-fail rules.

Worked Example: Locating a Large Cumulative Weight

Consider four illustrative treatment histories over two periods. Suppose the model assigns probability \(0.20\) to treatment in period 1 and probability \(0.80\) in period 2 for each person. The histories are \((1,1),(1,0),(0,1),(0,0)\), where the first entry is period 1 treatment. The incremental factors and cumulative products are:

HistoryPeriod 1 factorPeriod 2 factorCumulative weight
(1,1)\(1/0.20=5\)\(1/0.80=1.25\)\(5(1.25)=6.25\)
(1,0)\(1/0.20=5\)\(1/(1-0.80)=5\)\(5(5)=25\)
(0,1)\(1/(1-0.20)=1.25\)\(1/0.80=1.25\)\(1.25(1.25)=1.5625\)
(0,0)\(1/(1-0.20)=1.25\)\(1/(1-0.80)=5\)\(1.25(5)=6.25\)

The period 2 factor reaches 5 for untreated people, and the largest cumulative weight is 25 for history \((1,0)\). The table makes the source of that large product visible: both incremental factors equal 5. With actual study data, these summaries should be examined within periods and relevant histories, because a factor distribution can differ across those groups. Four illustrative histories cannot establish that a model is misspecified; they show why inspecting only the final product can hide where a problem arose.

Interpreting Diagnostics Without Overclaiming

A second useful identity explains how pooled calibration can hide time structure. Let \(\bar p_t\) be the mean fitted probability in period \(t\), and let \(\bar A_t\) be the observed treatment frequency there. If periods have equal sample sizes, the pooled difference is the average of the period differences:

$$ \bar p_{\mathrm{pooled}}-\bar A_{\mathrm{pooled}} = \frac{1}{T}\sum_{t=1}^T(\bar p_t-\bar A_t). $$

This follows because the pooled mean is the sum of the period-specific totals divided by the combined sample size \(Tn\), which equals the average of the \(T\) period means when each period has \(n\) observations. Positive and negative discrepancies can therefore cancel. For unequal period sizes, the same cancellation occurs through a sample-size-weighted average. Pooled agreement is not evidence that each period is calibrated.

In practice, plot observed treatment frequency against mean predicted probability separately by period, and where possible within clinically meaningful history groups. Look for systematic period patterns in calibration residuals, covariate imbalance after weighting, and factor or weight tails. Sparse groups make these diagnostics noisy, while empty or nearly empty treatment groups can indicate a positivity problem rather than merely a functional time trend. Check counts and uncertainty alongside plots; do not interpret a few observations as precise evidence.

The main alternatives are complementary, not interchangeable. Period-specific calibration is closest to checking probability accuracy but may miss covariate imbalance hidden within broad bins. Weighted balance directly checks measured covariates but cannot verify the probabilities for every aspect of the history. Weight-distribution summaries flag instability but do not identify the mechanism that created it. Comparing these views helps distinguish a temporal calibration issue from residual measured imbalance or extreme weighting, without turning any one diagnostic into a causal validity test.

These checks have important limits. They cannot detect unmeasured confounding, establish that all confounders were measured, or prove the causal assumptions required for a marginal structural model. A model may be calibrated in observed groups yet fail to represent treatment probabilities within finer histories. Conversely, sampling variation can produce apparent period discrepancies even when the model is correct. Diagnostics should therefore guide model revision and transparent sensitivity analysis, not certify a model as true.

Common pitfall: “The pooled observed treatment rate equals the pooled mean predicted probability, so the time component is adequate.” This reasoning ignores cancellation across periods. The correction is to examine calibration, balance, and weight factors by period and relevant histories, then use pooled summaries only as additional context.

Check Your Understanding

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

  1. Two equally sized periods have observed treatment rates \(0.25\) and \(0.75\), while the model predicts \(0.50\) in both. What is the pooled calibration difference, and what are the period-specific differences?
  2. State the positivity condition needed for the period-specific inverse-probability factors for a binary treatment.
  3. In a period, 30 treated people have fitted probability \(0.60\), and 70 untreated people have fitted probability \(0.60\). Calculate the treated and untreated weighted totals.
  4. Why should incremental factors be inspected in addition to cumulative weights?

Solutions. (1) The pooled observed rate is \((0.25+0.75)/2=0.50\), so the pooled predicted-minus-observed difference is zero. The period differences are \(0.50-0.25=0.25\) and \(0.50-0.75=-0.25\). (2) For histories being analyzed, \(0<p_t(H_t)<1\); otherwise one of the treatment-specific inverse factors is undefined or unsupported. (3) Treated total: \(30/0.60=50\). Untreated total: \(70/(1-0.60)=175\). (4) A cumulative product does not show which period contributed a large factor; period-specific inspection can locate the time at which probabilities or weight tails become problematic.

Clinical Biostats