Tutorials › Marginal Structural Models › HIV Treatment Adherence and Viral Suppression

Case Studies · Tutorial 481 of 501

HIV Treatment Adherence and Viral Suppression

Learn to define adherence strategies, identify their marginal viral-suppression risks using the longitudinal g-formula or inverse-probability weights, and recognize where the analysis can fail.

Advanced 12 min read

What You'll Learn

  • Define sustained adherence interventions and a marginal viral-suppression estimand.
  • Represent how earlier adherence changes later viral load and adverse effects.
  • State the assumptions needed to identify intervention-specific suppression risks.
  • Derive the two-period longitudinal g-formula and inverse-probability-weighted identity.
  • Calculate and compare risks using standardization and adherence weights.
  • Diagnose poor overlap, model dependence, and limitations of adherence measurement.

Why Adherence Requires a Longitudinal Analysis

In an HIV cohort, earlier adherence may improve viral load, while adverse effects may make later adherence harder. Both viral load and adverse effects can also predict whether a patient adheres at the next visit and whether viral suppression is ultimately achieved. This is treatment-confounder feedback: a time-varying confounder of later adherence and outcome is itself affected by earlier adherence.

Adjusting for the latest viral load in an ordinary outcome regression can therefore change the question. It may block part of the effect of earlier adherence, while failing to correctly handle confounding of later adherence. A marginal structural model (MSM) instead targets outcomes under specified adherence interventions, marginal over the covariate histories those interventions would produce.

Consider two adherence decisions. Let \(C\) denote baseline covariates, including baseline viral load if measured, and let \(L_1\) denote viral load and adverse effects measured after the first decision but before the second. Let \(A_0\) and \(A_1\) indicate adherence at the first and second decisions, and let \(Y=1\) indicate viral suppression at the outcome visit. The intervention \((a_0,a_1)\) sets adherence to \(a_0\) and \(a_1\) at the two decisions.

Definition: \(Y^{a_0,a_1}\) is the viral-suppression outcome that would be observed under the adherence intervention setting \(A_0=a_0\) and \(A_1=a_1\). The marginal suppression risk under that intervention is \(P(Y^{a_0,a_1}=1)\). For example, \((1,1)\) represents adherence at both decisions, and \((0,0)\) represents nonadherence at both.

The intervention must be sufficiently well defined to have a meaningful interpretation. In practice, the study should specify what counts as adherence, how it is measured, and what regimen is being taken. “Set adherence to one” is not a complete clinical protocol if the timing, adherence threshold, or treatment regimen is ambiguous.

Identification Assumptions and the Longitudinal Formula

The following assumptions connect the intervention risks to observed data. Consistency requires that a patient who follows \((a_0,a_1)\) has observed outcome \(Y=Y^{a_0,a_1}\), and that the measured adherence corresponds to the intervention being studied. No interference means one patient’s adherence does not change another patient’s outcome. Sequential exchangeability requires no unmeasured confounding of adherence and future potential outcomes at either decision, conditional on the recorded history. In particular, \(A_0\) is conditionally independent of the relevant potential outcomes given baseline \(C\), and \(A_1\) is conditionally independent of future potential outcomes given the history \(C,A_0,L_1\).

Positivity requires that, for histories that can arise under the intervention, the probability of receiving the intervention’s specified adherence at each decision is positive. If, for example, no patient with severe adverse effects adheres at the second decision, the data cannot identify the second-period adherence intervention for that history by these methods.

Write \(H_0=C\) and \(H_1=(C,A_0,L_1)\). Under consistency, sequential exchangeability, and positivity, the risk under a fixed two-decision intervention is identified by the longitudinal g-formula:

$$ P(Y^{a_0,a_1}=1) = \sum_c \sum_{l_1} P(Y=1\mid C=c,A_0=a_0,L_1=l_1,A_1=a_1) P(L_1=l_1\mid C=c,A_0=a_0) P(C=c). $$

For continuous covariates or viral-load measurements, the sums are replaced by integrals. This formula averages the outcome risk over the distribution of intermediate history expected under the first intervention decision. It does not hold \(L_1\) fixed at its observed distribution regardless of \(a_0\).

Result: The displayed g-formula gives the marginal risk \(P(Y^{a_0,a_1}=1)\) under consistency, sequential exchangeability at both adherence decisions, and positivity for the specified intervention at histories it can generate.

To see the derivation, first condition the potential outcome on baseline \(C\) and on the intermediate variable \(L_1^{a_0}\). By iterated expectation, its conditional mean is an average of \(E[Y^{a_0,a_1}\mid C=c,L_1^{a_0}=l_1]\) over the distribution of \(L_1^{a_0}\) given \(C=c\). Consistency and exchangeability at the first decision identify that distribution as \(P(L_1=l_1\mid C=c,A_0=a_0)\). Exchangeability at the second decision and consistency identify the conditional outcome mean as \(E[Y\mid C=c,A_0=a_0,L_1=l_1,A_1=a_1]\). Averaging over \(P(C=c)\) gives the displayed formula. \(\square\)

Worked Example: Adherence Changes the Intermediate History

Suppose baseline covariates are fixed, and \(L_1=1\) means that viral load is high or adverse effects are present. The observed history models give \(P(L_1=1\mid A_0=1)=0.20\) and \(P(L_1=1\mid A_0=0)=0.60\). The modeled suppression risks conditional on \(L_1\) are \(0.70\) and \(0.95\) for \(A_0=A_1=1\), when \(L_1=1\) and \(0\), respectively; for \(A_0=A_1=0\), they are \(0.20\) and \(0.60\).

Under sustained adherence, the g-formula averages the outcome risks over the \(L_1\) distribution under \(A_0=1\):

$$ P(Y^{1,1}=1) =0.20(0.70)+0.80(0.95) =0.14+0.76 =0.90. $$

Under sustained nonadherence, the relevant intermediate distribution is instead the one under \(A_0=0\):

$$ P(Y^{0,0}=1) =0.60(0.20)+0.40(0.60) =0.12+0.24 =0.36. $$

The estimated marginal risk difference is \(0.90-0.36=0.54\), or 54 percentage points. The contrast includes both the later-adherence pathway and the change in the intermediate history caused by the first adherence decision.

Inverse-Probability Weighting

A second way to estimate intervention risks uses inverse-probability weights. Define the adherence probabilities \(g_0(a_0\mid C)=P(A_0=a_0\mid C)\) and \(g_1(a_1\mid C,A_0,L_1)=P(A_1=a_1\mid C,A_0,L_1)\). For a fixed intervention, the weight for one observed patient is

$$ W^{a_0,a_1} = \frac{I(A_0=a_0,A_1=a_1)} {g_0(a_0\mid C)\,g_1(a_1\mid C,A_0,L_1)}. $$

Only patients whose observed adherence follows the intervention contribute to this weight. Those patients are upweighted according to how unlikely their adherence sequence was, given their measured histories. The normalized weighted mean estimates the intervention risk:

$$ \widehat{P}(Y^{a_0,a_1}=1) = \frac{\sum_{i=1}^{n} W_i^{a_0,a_1}Y_i} {\sum_{i=1}^{n} W_i^{a_0,a_1}}. $$
Result: Under the same consistency, sequential exchangeability, and positivity conditions, \(E[W^{a_0,a_1}Y]=P(Y^{a_0,a_1}=1)\) and \(E[W^{a_0,a_1}]=1\).

For the first identity, condition on \(C\). The indicator \(I(A_0=a_0)\) cancels its probability \(g_0(a_0\mid C)\) in expectation. Among those histories, condition on \(L_1\) and \(A_1\); the indicator \(I(A_1=a_1)\) cancels \(g_1(a_1\mid C,A_0,L_1)\). The resulting expectation averages the observed conditional outcome mean over \(P(L_1\mid C,A_0=a_0)\), which equals the g-formula risk by sequential exchangeability and consistency. Repeating the cancellation without \(Y\) gives one for every baseline history, so \(E[W^{a_0,a_1}]=1\). Thus the normalized weighted mean has the target risk as its population counterpart. \(\square\)

Worked Example: Calculating Adherence Weights

For the sustained-adherence intervention, suppose the estimated first-decision adherence probability is \(0.50\) for every patient. Among patients with \(A_0=1\), the estimated second-decision adherence probability is \(0.80\) when \(L_1=0\) and \(0.40\) when \(L_1=1\). Five observed patients follow \(A_0=A_1=1\): two have \(L_1=0\), with outcomes \(Y=1,1\); three have \(L_1=1\), with outcomes \(Y=1,0,0\). Other patients in the cohort do not follow this intervention and have weight zero for this calculation.

Each of the two \(L_1=0\) patients has weight \(1/(0.50\times0.80)=2.5\). Each of the three \(L_1=1\) patients has weight \(1/(0.50\times0.40)=5\). The weighted numerator is \(2.5(1+1)+5(1+0+0)=5+5=10\). The denominator is \(2(2.5)+3(5)=5+15=20\). Therefore the weighted estimate is \(10/20=0.50\). The unweighted mean among these five patients is \(3/5=0.60\); weighting changes the contribution of the less likely adherence histories.

Marginal Risks, Diagnostics, and Method Choice

Worked Example: Standardizing Over Baseline Severity

Suppose the baseline population has 60% of patients in a lower-severity stratum and 40% in a higher-severity stratum. A fitted longitudinal outcome analysis estimates suppression risks under sustained adherence of \(0.84\) and \(0.60\) in the two strata, respectively. Under sustained nonadherence, the corresponding risks are \(0.48\) and \(0.25\).

The marginal risks use the same baseline distribution for both interventions. Under adherence, the risk is \(0.60(0.84)+0.40(0.60)=0.504+0.240=0.744\). Under nonadherence, it is \(0.60(0.48)+0.40(0.25)=0.288+0.100=0.388\). The marginal risk difference is \(0.744-0.388=0.356\), and the marginal risk ratio is \(0.744/0.388\approx1.92\). These are population-average contrasts, not stratum-specific effects.

The g-formula and inverse-probability weighting target the same intervention risks but rely on different fitted components. The g-formula models the intermediate-history distribution and the outcome conditional on history, then averages predictions under each intervention. Weighting models the adherence probabilities and reweights the observed outcomes. Either approach can be misleading if its required models are badly specified; agreement between them can be informative but does not establish that unmeasured confounding is absent.

Useful diagnostics include examining adherence probabilities across histories, checking whether predicted probabilities are near zero, and comparing distributions of measured history variables after weighting. Large weights indicate that some observed adherence sequences were rare under their recorded histories, so a small number of patients may dominate the estimate. Also check whether viral load and adverse effects were measured before the adherence decision they are meant to predict. If they are recorded after that decision, the proposed temporal ordering is not supported by the data.

A conventional regression that adjusts for \(L_1\) and reports a coefficient for adherence is not generally a substitute for either approach: it may condition away part of the effect of \(A_0\), and a conditional coefficient need not equal the marginal intervention contrast. The g-formula is often convenient when conditional outcome and covariate models are credible; weighting gives a direct reweighted marginal estimate but can be unstable when adherence probabilities are small.

Neither method repairs violations of the causal assumptions. Unmeasured substance use, access to medication, or illness severity can confound adherence and suppression. Misclassified adherence, inconsistent treatment versions, or poor positivity can also undermine interpretation. The two-decision setup is illustrative; a longer follow-up requires histories and adherence probabilities at every decision, with the same temporal care.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. In this setting, why can \(L_1\) be both a confounder of \(A_1\) and an effect of \(A_0\)?
  2. Suppose \(P(L_1=1\mid A_0=1)=0.30\), and the suppression risks under \(A_0=A_1=1\) are \(0.60\) when \(L_1=1\) and \(0.90\) when \(L_1=0\). What is the g-formula risk?
  3. For an observed adherence sequence with \(g_0=0.50\) and \(g_1=0.25\), what is its weight for the matching intervention?
  4. What does a near-zero estimated probability of second-period adherence among patients with severe adverse effects imply?

Solutions: (1) Earlier adherence can change viral load or adverse effects, while those variables can predict both later adherence and suppression. (2) \(0.30(0.60)+0.70(0.90)=0.18+0.63=0.81\). (3) The weight is \(1/(0.50\times0.25)=8\). (4) Positivity may fail or be practically weak for that history; the intervention risk is unsupported or unstable there, and weighting cannot create information absent from the data.

Clinical Biostats