The HIV Cohort and the Question
Suppose an HIV cohort records antiretroviral therapy and CD4 count at regular visits, then follows patients for death. At each visit, a low CD4 count makes treatment more likely and predicts mortality. Earlier therapy can also change the next CD4 count. The central challenge is therefore not simply that CD4 is a confounder: it is a time-varying confounder affected by prior treatment.
Consider two sustained strategies: initiate antiretroviral therapy at the first eligible visit and continue it, or do not initiate during follow-up. The target is the survival that would be observed under each strategy in the eligible cohort. This is a marginal comparison over the cohort, not a comparison restricted to people with the same observed CD4 history.
For clarity, the derivations below assume death is ascertained for everyone through the study horizon: there is no loss to follow-up or administrative censoring before that horizon. If censoring occurs, censoring weights must also be included, under appropriate conditional independent-censoring and positivity assumptions. The treatment weights below do not by themselves correct loss to follow-up.
Why CD4 Feedback Changes the Analysis
Write \(H_k=(L_0,A_0,L_1,A_1,\ldots,A_{k-1},L_k)\) for the measured history available before treatment at \(k\), with baseline covariates included in \(L_0\). A simple causal ordering is
CD4 count is a confounder of the current treatment-death relation because it predicts both current therapy and death. But it is also affected by earlier treatment. A conventional regression that adjusts for current CD4 can remove part of the effect of earlier therapy carried through CD4; omitting CD4 can leave the current treatment decision confounded. Marginal structural weighting addresses this feedback by balancing measured treatment histories without conditioning the final survival comparison on the observed post-treatment CD4 distribution.
Worked Example: A CD4-Dependent Treatment Decision
Suppose, at a later visit, 100 patients are alive: 50 have low CD4 and 50 have higher CD4. In the low-CD4 group, 40 start treatment; in the higher-CD4 group, 10 start. Thus the observed treatment probabilities are \(40/50=0.8\) and \(10/50=0.2\). If the target is treatment at this visit for everyone, a treated low-CD4 patient receives treatment weight \(1/0.8=1.25\), while a treated higher-CD4 patient receives weight \(1/0.2=5\).
The weighted treated counts are \(40(1.25)=50\) and \(10(5)=50\). The weighted treated group therefore has 50 low-CD4 and 50 higher-CD4 patients, matching the original risk set's CD4 composition. This arithmetic illustrates the balancing purpose of the weights; it does not establish that all confounding is controlled. In particular, it requires that the measured history adequately captures the factors governing treatment and death.
If earlier therapy raised some patients' CD4 counts, CD4 may also lie on a pathway from earlier treatment to later survival. The weight does not declare CD4 irrelevant. It uses CD4 to model treatment assignment at each decision while the final contrast targets the overall effect of the sustained strategy, including pathways through subsequent CD4.
Treatment Weights and Risk-Set Identification
Let \(p_j(g_j\mid H_j)=P(A_j=g_j\mid H_j,S_j=1)\) be the conditional probability of receiving the strategy-specified treatment at interval \(j\), among patients alive and followed at that decision. For a deterministic strategy, define the weight for a patient who is alive at the start of interval \(k\) and has followed the strategy through the treatment decision at \(k\) by
This weight is defined on the observed risk set at \(k\); it is not a weight for someone who died before that visit. For such a person, set \(S_kW_k^g=0\), and do not interpret \(W_k^g\) as a defined treatment-history weight. The inclusion of the current decision \(A_k\) means this weighted risk set represents patients who followed the strategy through the treatment decision at \(k\).
Under these assumptions, for any bounded function \(f\) of the history and outcome available from the risk set through interval \(k\), interpreted on that risk set, the relevant identity is
Here \(f^g\) is the corresponding function evaluated on the potential history under \(g\). The factor \(S_k\) is essential: this identity concerns people alive and followed at the start of \(k\), not arbitrary trajectories that include people who died earlier.
To verify the identity, condition successively on the histories at each treatment decision. For a history with \(S_j=1\), the treatment factor has conditional expectation
More than this mean-one calculation is needed to identify outcomes: sequential exchangeability permits replacing the observed outcome distribution among those receiving \(g_j\), conditional on \(H_j\), by the corresponding potential-outcome distribution under that treatment. Consistency then identifies the observed history and outcome of those who received \(g_j\) with that potential history and outcome. Apply this argument first at \(j=k\), conditional on the pre-decision history and survival, then at \(j=k-1\), and continue back to \(j=0\). At each step, the treatment indicator selects the strategy treatment, the inverse probability cancels its conditional selection probability, and the potential history is the one generated under \(g\). The survival factor remains throughout, so trajectories that have already ended in death do not enter the risk-set identity. This gives the stated equality. \(\square\)
From Weighted Risk Sets to Marginal Survival
Apply the risk-set identity first with \(f=1\), then with \(f=D_{k+1}\). The strategy-specific interval death risk among those alive at the start of interval \(k\) is identified by the ratio
The denominator is the weighted number (or population total) at risk; the numerator is the weighted deaths in that risk set. This formula uses outcomes only for people at risk at the start of the interval. It does not assert an identity for a function defined over all patients regardless of earlier death.
Since survival through interval \(k\) requires survival to its start and no death during it, the law of conditional probability gives
Starting from \(P(S_0^g=1)=1\), repeated multiplication yields the marginal survival curve:
In a sample, replace the expectations in the risk-set ratio by sums over people, using their observed weights. The resulting weighted hazard estimate is
This is a weighted discrete-time survival calculation. It is not a claim that the weighted sample is literally a randomized trial: its causal interpretation still depends on the assumptions above and on adequate estimation of the treatment probabilities.
Worked Survival Calculations
Worked Example: A Weighted Death Risk
At one interval, four patients are alive at the start, have followed a specified strategy through the treatment decision, and have weights \(2,2,4,4\). Their death indicators during the interval are \(1,0,0,1\). The weighted risk-set total is
\(2+2+4+4=12.\)
The weighted death total is \(2(1)+2(0)+4(0)+4(1)=6\). Thus \(\hat q_k^g=6/12=0.5\). The unweighted fraction dying is \(2/4=0.5\) in this example, but that agreement is accidental: it does not make weighting unnecessary, since the weighted and unweighted risk sets can have different CD4 compositions and death risks in other data.
Worked Example: Two-Interval Survival Under a Strategy
Suppose the weighted calculation gives \(\hat q_0^g=0.20\) in the first interval and \(\hat q_1^g=0.25\) in the second. The estimated survival to the start of interval 1 is \(1-0.20=0.80\). Survival through the second interval is
\((1-0.20)(1-0.25)=0.80(0.75)=0.60.\)
Thus estimated survival to the start of interval 2 is \(0.60\), and estimated cumulative death risk by then is \(1-0.60=0.40\). The second hazard is conditional on surviving to the second interval under the strategy; it is not a 25% risk among the original cohort.
Worked Example: Comparing Two Sustained Strategies
Suppose the weighted hazards under sustained initiation are \(0.10\) and \(0.20\) over two intervals, and those under sustained non-initiation are \(0.15\) and \(0.30\). The corresponding survival estimates are
\(1-(1-0.10)(1-0.20)=1-(0.90)(0.80)=0.28\) cumulative death risk under initiation, and
\(1-(1-0.15)(1-0.30)=1-(0.85)(0.70)=0.405\) cumulative death risk under non-initiation.
The estimated survival at the end of the two intervals is therefore \(0.72\) versus \(0.595\), a difference of \(0.125\). This is a strategy contrast, not an effect of receiving a single dose at baseline. In a real analysis, uncertainty intervals and sensitivity analyses would be needed before interpreting the numerical difference substantively.
Diagnostics, Alternatives, and Limitations
The strategy may be poorly supported by the observed data. For example, if almost no patients with a particular CD4 history receive treatment, the estimated probability \(p_j(g_j\mid H_j)\) can be close to zero. Its reciprocal then gives a very large weight. Inspect the distribution of weights by interval and strategy, the number of patients represented in weighted risk sets, and how much of the total weight is contributed by a few observations. Also inspect treatment-probability calibration across important histories, including CD4. Extreme weights can signal limited positivity, sparse data, or misspecification; truncating them may improve stability but changes the estimator and can introduce bias.
An ordinary outcome regression that conditions on time-varying CD4 is a possible alternative model-based approach, but a simple regression coefficient for treatment does not automatically estimate the marginal sustained-strategy contrast. Because CD4 is affected by prior therapy, conditioning on it at later visits may alter the pathways represented in that coefficient. A correctly specified longitudinal g-formula is another approach to the same causal target, but it requires modeling the covariate and outcome evolution under specified strategies. Weighting instead models treatment assignment and uses weighted risk sets. None of these approaches repairs unmeasured confounding or lack of support.
Further limitations include measurement error in CD4 or treatment timing, treatment-probability models that omit important history, and an ill-defined intervention—for example, “continue therapy” may not specify what happens after intolerance or regimen changes. The cohort's eligibility criteria and time zero must also match the intended strategy comparison. A numerically smooth survival curve is not evidence that these design and measurement conditions hold.
- Common mistake: adjust for every observed CD4 count in a conventional outcome model. The reasoning is that CD4 predicts both treatment and death, so adjustment must always remove bias. But later CD4 may also be affected by earlier treatment; conditioning on it can change the total strategy effect being targeted. Use a method whose estimand and assumptions address this feedback.
- Common mistake: apply a treatment weight to everyone, including people who died before the visit. Such people have no treatment decision at that visit. Define weights on the relevant risk set and use the survival indicator in the risk-set identity and hazard calculation.
- Common mistake: treat a large weighted sample size as proof of positivity. A few extremely large weights may dominate even when the nominal total is large. Examine weight concentration and history-specific treatment support.
Check Your Understanding
Use the definitions and assumptions above. Short solutions follow the questions.
- Why can CD4 at a later visit be both a confounder of current treatment and a consequence of earlier treatment?
- At a risk set, 30 of 60 patients with low CD4 receive the strategy treatment. What is the treatment weight for a treated patient with that history?
- Why must the weighted identity for interval death risk include the risk-set indicator?
- If two strategy-specific interval hazards are \(0.10\) and \(0.20\), what is survival through both intervals?
- Name two reasons a treatment weight may become extreme, and one diagnostic you would examine.
Solutions. (1) Earlier therapy may alter later CD4, while that CD4 level influences the next treatment decision and predicts death. (2) The probability is \(30/60=0.5\), so the inverse-probability weight is \(1/0.5=2\). (3) Treatment is only defined for patients alive at the decision; those who died earlier do not belong to that interval's risk set, and the hazard is conditional on being at risk. (4) Survival is \((1-0.10)(1-0.20)=0.90(0.80)=0.72\). (5) Near-zero treatment probabilities, sparse histories, or a misspecified treatment model can produce extreme weights; inspect the interval-specific weight distribution and concentration in a few observations.