Tutorials › Marginal Structural Models › Weighted Survival Contrasts in an HIV Treatment Cohort

Case Studies · Tutorial 489 of 501

Weighted Survival Contrasts in an HIV Treatment Cohort

Work through weighted survival estimation for changing antiretroviral strategies, including the assumptions, calculations, interpretation, and diagnostics behind marginal survival and hazard contrasts.

Advanced 13 min read

What You'll Learn

  • Define marginal survival under sustained and CD4-based antiretroviral strategies
  • Construct treatment and censoring weights for an HIV cohort with changing CD4 counts
  • Derive the weighted discrete-time hazard and product-limit survival estimator
  • Calculate and interpret survival differences and restricted mean survival contrasts
  • Explain why hazard ratios can vary over time even when survival curves are estimated marginally
  • Diagnose unstable weighted survival estimates and distinguish them from crude or outcome-model estimates

Why Compare Survival Under Antiretroviral Strategies?

In an HIV cohort, CD4 count is measured repeatedly and can influence whether treatment is started, continued, or changed. It also predicts survival. Because earlier antiretroviral treatment can itself change later CD4 count, comparing people according to the treatment they happened to receive can mix treatment effects with differences in evolving health status. A weighted survival analysis instead aims to compare survival under explicitly specified treatment strategies.

The target is usually a contrast between marginal survival curves: the probability of surviving beyond a given time if the cohort followed one strategy, compared with the probability if it followed another. A hazard-based summary can also be reported, but it answers a different question and may vary over time. The distinction matters when effects change or when the marginal survival curves cross.

Strategies, Outcomes, and Assumptions

Let \(T\) be time to death, measured in discrete intervals, and let \(T^g\) be the potential event time under treatment strategy \(g\). A strategy can specify a fixed treatment plan, such as starting and continuing a regimen, or a dynamic rule, such as starting when CD4 count falls below a stated threshold. Write \(A_t\) for treatment at decision time \(t\), and \(L_t\) for the CD4 and other measured clinical history available before that decision. The history \(H_t\) contains baseline covariates and measured treatment and covariate history up to the decision.

Definition: For \(t=0,\ldots,K-1\), define the marginal survival probability under strategy \(g\) by \(S^g(k)=P(T^g>k)\), where \(k=0,\ldots,K\). The discrete-time marginal hazard in interval \(t\) is \(h_t^g=P(t<T^g\leq t+1\mid T^g>t)\). Thus \(1-h_t^g\) is the probability of surviving interval \(t\), conditional on surviving to its start.

The survival and hazard definitions imply the exact relationship

$$ S^g(k)=\prod_{t=0}^{k-1}(1-h_t^g),\qquad k=1,\ldots,K,\quad S^g(0)=1. $$

For a causal interpretation, the usual requirements are consistency (the observed outcome agrees with the potential outcome under the treatment actually followed), no interference between cohort members, and sequential exchangeability: conditional on the measured history \(H_t\), treatment choice at time \(t\) is independent of future potential survival under the strategies being compared. Censoring must likewise be conditionally independent of future potential survival given measured history, or adequately handled by censoring weights. The required treatment and censoring probabilities must be positive for histories represented in the target population. The probability models used to estimate those probabilities must also be correctly specified, unless a method with additional robustness properties is used.

Constructing and Using the Weights

For a deterministic strategy \(g\), let \(q_{it}^g=P(A_{it}=g_t(H_{it})\mid H_{it},T_i>t,C_i>t)\) be the probability that person \(i\) follows the strategy at decision \(t\). Let \(r_{it}\) be the conditional probability of remaining uncensored through the next interval, given the observed history and treatment. A simple unstabilized weight for a person who follows \(g\) and has the interval outcome observed is

$$ W_{it}^g= \frac{ \prod_{s=0}^{t} I\{A_{is}=g_s(H_{is})\} \; I\{\text{uncensored through interval }t\} }{ \left\{\prod_{s=0}^{t}q_{is}^g\right\} \left\{\prod_{s=0}^{t}r_{is}\right\} }. $$

The indicators retain observations compatible with the strategy and with outcome ascertainment. The denominators reweight those retained observations to represent people whose treatment choices and continued observation could otherwise be underrepresented. In practice, weights may be stabilized, but the resulting estimand and any covariates included in the marginal structural model must be aligned with the stabilization numerators.

At each interval, estimate the marginal hazard using the weighted event total divided by the weighted risk-set total. The risk set comprises those who survived to the interval start; censoring weights account for incomplete outcome observation. Multiplying one minus these weighted hazards gives a weighted product-limit estimate of the strategy-specific survival curve. Alternatively, a weighted pooled logistic model can estimate interval hazards, with a flexible function of time and terms that distinguish strategies. Its fitted hazards are then multiplied to obtain survival.

Worked Example: Calculating a Strategy Weight

Suppose a participant follows the strategy to start treatment at baseline and continue it at the next decision. The estimated probabilities of following the strategy at the two decisions are \(0.40\) and \(0.70\). The probabilities of remaining observed through the corresponding intervals are \(0.90\) and \(0.80\). The participant follows the strategy and is uncensored through both intervals.

The treatment probability product is \(0.40\times0.70=0.28\), and the censoring probability product is \(0.90\times0.80=0.72\). The combined probability in the denominator is \(0.28\times0.72=0.2016\). The weight is therefore

$$ W=\frac{1}{0.2016}=4.9603\ \text{(approximately)}. $$

This participant represents about 4.96 participants with this measured history in the weighted analysis. The large value is not evidence that the treatment was effective; it reflects that this observed treatment and follow-up history was relatively unlikely under the estimated assignment and censoring processes.

Theorem: Suppose the treatment and censoring probabilities are correctly specified and positive, sequential exchangeability and consistency hold, and the relevant interval outcomes are observed under the censoring-weighted scheme. Then the population weighted risk-set event proportion in interval \(t\) equals \(h_t^g\). Consequently, the product of the population weighted interval survival proportions through \(k-1\) equals \(S^g(k)\).

Justification. Consider histories at risk at the beginning of an interval. In the weighted population, an observed history compatible with \(g\) is multiplied by the inverse of its conditional probability of following \(g\). Conditional expectation over the treatment choice cancels that probability: the contribution from a history is multiplied by \(q_t^g/q_t^g=1\). Repeating this argument from the first decision through \(t\) removes selection induced by each treatment decision. The corresponding inverse censoring factors cancel the conditional probabilities of remaining observed, restoring the distribution of the eligible risk set under complete outcome ascertainment.

By consistency, outcomes for individuals who followed \(g\) are their outcomes under \(g\); sequential exchangeability permits this observed outcome distribution to represent the counterfactual distribution under \(g\). Therefore the weighted event total divided by the weighted risk-set total equals \(P(t<T^g\leq t+1\mid T^g>t)=h_t^g\). The weighted interval survival proportion is \(1-h_t^g\). Multiplication over \(t=0,\ldots,k-1\) gives

$$ \prod_{t=0}^{k-1}(1-h_t^g) =P(T^g>k)=S^g(k), $$

where the first equality follows by the chain rule for conditional probabilities of surviving consecutive intervals. This establishes the stated population result. In a finite cohort, the corresponding weighted estimates converge to it under independent sampling, finite follow-up horizon, positive probabilities, and consistent estimation of the treatment and censoring probabilities. \(\square\)

Worked Example: Computing and Contrasting Weighted Survival

Suppose the weighted risk-set and event totals for an early-treatment strategy are as follows. The weighted totals need not be integers.

Interval \(t\)Weighted at riskWeighted eventsEstimated hazard
0100100.10
184120.1429
265130.20

The hazards are \(10/100=0.10\), \(12/84=1/7\approx0.1429\), and \(13/65=0.20\). The estimated survival probabilities are

$$ \widehat S^{E}(1)=0.90,\quad \widehat S^{E}(2)=0.90(1-12/84)=0.7714,\quad \widehat S^{E}(3)=0.7714(1-13/65)=0.6171. $$

Suppose the comparator strategy has estimated interval hazards \(0.08\), \(0.10\), and \(0.12\). Its survival at time 3 is \(0.92\times0.90\times0.88=0.72864\). The estimated survival difference at time 3, early treatment minus comparator, is \(0.61714-0.72864=-0.11150\), or about 11.2 fewer survivors per 100 people by that time under the early-treatment strategy. This is a marginal contrast for the target population, subject to the assumptions and estimation quality above.

Survival Contrasts and Hazard Summaries

A direct and often interpretable contrast is the risk difference in survival at a chosen time, \(S^{g_1}(k)-S^{g_0}(k)\). A risk ratio \(S^{g_1}(k)/S^{g_0}(k)\) is another option. The restricted mean survival time through \(K\) intervals is the expected time alive within that horizon. For discrete intervals of unit length it is

$$ \operatorname{RMST}^{g}(K)=\sum_{k=0}^{K-1} S^g(k). $$

This follows because the time alive up to \(K\) is the sum of the indicators \(I(T^g>k)\) over \(k=0,\ldots,K-1\); taking expectations gives the displayed sum. A difference in restricted mean survival describes average time gained or lost within the stated horizon, rather than a relative rate at an instant.

A hazard ratio compares conditional event rates among those who have survived to each interval. It is not generally a constant or a simple transformation of a survival difference. In addition, the people remaining at risk under two strategies can differ because earlier survival differs. Thus a marginal hazard contrast is not an average of individual-level treatment effects.

Worked Example: Checking Whether a Single Hazard Ratio Summarizes the Curves

Suppose one strategy has interval hazards \(0.10\), \(1-0.80/0.90\), and \(0.30\). The comparator has hazards \(0.10\), \(1-0.85/0.90\), and \(0.141\). These values correspond in the second interval to survival changing from \(0.90\) to \(0.80\) under the first strategy, and from \(0.90\) to \(0.85\) under the comparator.

The interval hazard ratios are, in order,

$$ \frac{0.10}{0.10}=1.00,\qquad \frac{1-0.80/0.90}{1-0.85/0.90} =\frac{1/9}{1/18}=2.00,\qquad \frac{0.30}{0.141}\approx2.13. $$

The ratios differ substantially across intervals. Reporting a single proportional-hazards summary would therefore conceal this pattern unless a model imposes and adequately represents a common hazard ratio. The survival curves and a prespecified-time survival difference remain interpretable without that constant-ratio assumption.

Diagnostics, Alternatives, and Limits

A weighted survival curve should be accompanied by checks of the estimated treatment and censoring probabilities, the distribution of weights, and the size of the effective weighted risk sets. At each time, inspect how many deaths and how much weighted person-time support the estimate. A curve driven by a few highly weighted observations or intervals with almost no weighted risk set can be unstable. Compare important measured history distributions across strategy-weighted groups, including prior CD4 count and viral suppression; notable imbalance may signal inadequate weighting or model specification.

The crude Kaplan–Meier comparison is simpler, but it does not adjust for changing CD4-related treatment selection. An outcome-regression approach models survival conditional on covariates and then standardizes predictions; it relies on adequate outcome-model specification. Weighted estimation instead models treatment and censoring assignment. A weighted pooled logistic model is useful for flexible interval-specific hazards, while the weighted product-limit calculation provides a transparent construction when hazards are estimated separately by interval. These methods do not remove bias from unmeasured confounding, poor measurement of CD4 history, or lack of treatment support. Weight truncation can reduce variance but changes the analysis and may introduce bias; it should not be treated as a cure for unsupported comparisons.

A common mistake is to interpret a weighted survival curve as automatically causal because weights were used. The correction is to check the strategy definition, consistency, exchangeability, positivity, censoring assumptions, and probability-model fit. Another mistake is to read \(1-h_t^g\) as survival beyond time \(t+1\) without multiplying the preceding interval survival probabilities. Under the hazard definition used here, \(1-h_t^g=P(T^g>t+1\mid T^g>t)\); the full survival probability is the product across intervals.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. If the interval hazards under a strategy are \(0.20\) and \(0.25\), what is survival beyond time 2?
  2. Why can changing CD4 count be a confounder in an antiretroviral survival comparison?
  3. For two strategies, estimated survival at time 4 is \(0.70\) and \(0.64\). What is the first strategy minus the second survival difference?
  4. If interval hazard ratios are \(0.8\), \(1.0\), and \(1.7\), what does this imply about reporting one constant ratio without qualification?

Solutions. (1) \(S(2)=(1-0.20)(1-0.25)=0.80\times0.75=0.60\). (2) CD4 predicts later treatment and survival, while earlier treatment can alter later CD4; ordinary adjustment for current CD4 can therefore fail to represent the desired sustained-strategy comparison. (3) \(0.70-0.64=0.06\), a six-percentage-point survival advantage at time 4 for the first strategy. (4) The ratios vary across intervals, so a single constant ratio would not describe these interval contrasts; report time-specific contrasts or justify the proportional-hazards restriction.

Clinical Biostats