Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › CD4 Counts and AIDS-Free Survival in HIV

Case Studies · Tutorial 668 of 697

CD4 Counts and AIDS-Free Survival in HIV

Learn how to model repeated CD4 counts jointly with time to AIDS or death, and interpret what the estimated CD4 trajectory says about event risk.

Advanced 12 min read

What You'll Learn

  • Set up a longitudinal CD4 submodel and a survival submodel for time to AIDS or death.
  • Interpret a current-value association parameter per 100 cells per cubic millimeter.
  • Distinguish estimated latent CD4 trajectories from noisy observed counts.
  • Calculate conditional hazard ratios and illustrate their relationship to event probabilities.
  • Identify assumptions, diagnostics, and limitations specific to the HIV cohort setting.
  • Compare a joint model with analyses that use observed CD4 measurements separately.

Why Model CD4 Counts and AIDS-Free Survival Together?

In an HIV cohort, CD4 counts measured repeatedly can describe immune status over time, while AIDS or death marks a clinically important event. These processes are connected: a participant with declining immune status may be more likely to experience the event, and the event itself stops subsequent CD4 measurements. An analysis that treats the last observed CD4 count as an ordinary complete record can therefore miss important dependence between the biomarker history and the event process.

A joint model represents the underlying, partly unobserved CD4 trajectory and relates it to the event hazard. The case study below uses a current-value association: at each time, the event hazard depends on the participant’s latent CD4 level at that time. The resulting association is conditional and model-based. It does not establish that changing CD4 by intervention would cause the estimated change in event risk.

Model and Assumptions

Let \(t=0\) be cohort entry, with time measured in years. For participant \(i\), \(y_{ij}\) is the \(j\)th observed CD4 count, in cells per cubic millimeter, at time \(t_{ij}\). Let \(T_i\) be the time to the first of AIDS or death, and let \(\delta_i=1\) if that event is observed and \(\delta_i=0\) if follow-up is right-censored. This composite endpoint treats AIDS and death as a single event; it does not estimate separate cause-specific associations.

Definition: A shared-parameter joint model specifies a longitudinal model for the observed CD4 counts and a time-to-event model whose hazard depends on the longitudinal process, typically through participant-specific random effects or a latent trajectory. Here \(m_i(t)\) denotes participant \(i\)’s latent mean CD4 count at time \(t\), rather than a single noisy observed count.

One illustrative longitudinal submodel is a linear mixed model:

$$ y_{ij}=m_i(t_{ij})+\epsilon_{ij}, \qquad m_i(t)=\beta_0+\beta_1t+\boldsymbol{\beta}_2^\mathsf{T}\mathbf{X}_i+b_{0i}+b_{1i}t, $$

where \(\mathbf{X}_i\) contains baseline covariates, \(b_{0i}\) and \(b_{1i}\) are participant-specific random intercept and slope, and the measurement errors \(\epsilon_{ij}\) are assumed independent of the random effects and normally distributed with mean zero and variance \(\sigma^2\). A common assumption is that \((b_{0i},b_{1i})^\mathsf{T}\) has a mean-zero multivariate normal distribution with covariance matrix \(\mathbf{D}\). A linear trajectory is a simplifying choice, not a biological law; plots and residual checks should support it over the follow-up period being analyzed.

For a current-value association, use the event hazard

$$ \lambda_i(t\mid b_{0i},b_{1i})= \lambda_0(t)\exp\left\{\boldsymbol{\gamma}^\mathsf{T}\mathbf{W}_i+ \alpha\frac{m_i(t)-500}{100}\right\}, $$

where \(\lambda_0(t)\) is the baseline hazard, \(\mathbf{W}_i\) contains baseline event-model covariates, and \(\alpha\) is the association parameter. Centering at 500 makes the baseline hazard correspond to a participant whose latent CD4 count is 500 cells per cubic millimeter and whose covariates \(\mathbf{W}_i\) are at their reference values. The division by 100 makes \(\alpha\) the log hazard ratio for a 100-cell higher latent CD4 count, holding other modeled quantities fixed.

This specification relies on assumptions that need to be considered in context. Conditional on the random effects and included covariates, the longitudinal measurement errors and event process are modeled as independent; the link through \(m_i(t)\) captures their modeled dependence. The event model must describe the baseline hazard adequately, and the longitudinal mean and random-effects structure must be plausible. Censoring is assumed non-informative conditional on the modeled information: after conditioning on the relevant covariates and random effects, censoring should not carry additional information about the event time. CD4 measurement times and missingness also require scrutiny; a joint event model does not automatically correct informative visit timing or every form of dropout.

Reading the Estimated CD4 Trajectory

The model distinguishes observed counts from the latent trajectory. An observed count includes measurement variation, whereas \(m_i(t)\) describes the model’s estimated underlying mean at time \(t\). The random intercept and slope allow participants to begin at different levels and change at different rates. In practice, a participant-specific trajectory estimate has uncertainty, especially when there are few measurements or measurements are far from the time being interpreted.

Worked Example: Interpreting One Participant’s Estimated Trajectory

Suppose a hypothetical participant has observed CD4 counts of 620, 550, and 500 cells per cubic millimeter at years 0, 1, and 2. A fitted joint model gives the participant-specific estimated latent trajectory \(m_i(t)=610-48t\), in cells per cubic millimeter, over this period.

At year 2, the estimated latent count is

$$ m_i(2)=610-48(2)=514\text{ cells per cubic millimeter}. $$

The observed count at year 2 is 500, so the observed value is 14 cells per cubic millimeter below the estimated latent mean at that time. That difference is not a contradiction: the observation includes measurement error. The estimated slope is \(-48\) cells per cubic millimeter per year. It summarizes the trajectory under the chosen linear model, not a guaranteed year-to-year decrease for every participant.

Interpreting the Current-Value Association

Because the hazard model uses \([m_i(t)-500]/100\), the hazard ratio for two otherwise identical participants whose latent CD4 counts differ by 100 cells per cubic millimeter at time \(t\) is \(\exp(\alpha)\) for the higher-count participant compared with the lower-count participant. If \(\alpha<0\), higher latent CD4 is associated with a lower conditional hazard of AIDS or death. Reversing the comparison, the hazard ratio for a 100-cell lower count is \(\exp(-\alpha)\).

Interpretation: In this model, \(\alpha\) describes the conditional association between current latent CD4 level and the instantaneous hazard of the composite event, given the event-model covariates and the model’s shared participant effects. It is not a risk ratio, a difference in event probabilities, or a causal effect.

The interpretation follows directly by comparing the two hazards at the same time and covariate values. If the second participant’s latent CD4 count is 100 cells per cubic millimeter higher, the difference between their scaled latent values is one:

$$ \frac{\lambda_{\mathrm{higher}}(t)}{\lambda_{\mathrm{lower}}(t)} = \frac{\lambda_0(t)\exp\{\boldsymbol{\gamma}^\mathsf{T}\mathbf{W}+\alpha x_{\mathrm{higher}}(t)\}} {\lambda_0(t)\exp\{\boldsymbol{\gamma}^\mathsf{T}\mathbf{W}+\alpha x_{\mathrm{lower}}(t)\}} =\exp\{\alpha[x_{\mathrm{higher}}(t)-x_{\mathrm{lower}}(t)]\} =\exp(\alpha), $$

where \(x(t)=[m(t)-500]/100\). The shared baseline hazard and equal covariate terms cancel. This is a hazard comparison at a given time, not a comparison of cumulative event probabilities over follow-up.

Worked Example: Hazard Ratio for a 100-Cell Difference

Suppose, in a hypothetical fitted model, the current-value estimate is \(\hat{\alpha}=-0.35\), with standard error \(SE=0.10\). The estimated hazard ratio for a 100-cell higher latent CD4 count is

$$ \exp(\hat{\alpha})=\exp(-0.35)=0.7047. $$

Thus, at the same time and with the modeled covariates held fixed, a 100-cell higher latent count is associated with an estimated hazard about 0.705 times as large, or about 29.5% lower. Equivalently, the hazard ratio for a 100-cell lower count is

$$ \exp(-\hat{\alpha})=\exp(0.35)=1.419. $$

For a Wald test of \(H_0:\alpha=0\), the statistic is \(z=-0.35/0.10=-3.50\). Its two-sided normal-reference p-value is approximately 0.00047. This is evidence against a zero current-value association under the fitted model; it is not the probability that \(H_0\) is true.

A 95% Wald confidence interval for \(\alpha\) is \(-0.35\pm1.96(0.10)\), or approximately \((-0.546,-0.154)\). Transforming the endpoints gives the interval for a 100-cell higher count:

$$ \left(\exp(-0.546),\exp(-0.154)\right)=(0.579,0.857). $$

The estimated higher-count hazard ratio is therefore 0.705, with a 95% confidence interval from 0.579 to 0.857. For a 100-cell lower count, reverse the contrast: the interval is \((\exp(0.154),\exp(0.546))=(1.166,1.726)\). These intervals quantify uncertainty in the model-based hazard ratio; they are not 95% probabilities that a fixed parameter lies within the realized interval.

From a Hazard Association to an Illustrative Event Probability

A hazard ratio does not directly give the ratio of event probabilities. To obtain a conditional event probability from a hazard model, one needs the cumulative hazard over the time interval. If the hazard is \(\lambda_i(u)\), the probability of the event by time \(t\), conditional on the modeled quantities, is \(1-\exp\{-\int_0^t\lambda_i(u)\,du\}\). When CD4 changes over time, the hazard changes with it, so the trajectory must be incorporated across the interval.

Worked Example: A One-Year Risk Under a Constant-Hazard Illustration

For a hypothetical illustration, suppose the baseline hazard is constant at \(0.08\) per year over the next year, \(\alpha=-0.35\), and other covariates are at their reference values. First hold each participant’s latent CD4 count fixed throughout that year. For a count of 600, the scaled value is \((600-500)/100=1\), so

$$ \lambda_{600}=0.08\exp(-0.35)=0.05638\text{ per year}, \qquad P(\text{event by 1 year})=1-\exp(-0.05638)=0.0548. $$

For a count of 400, the scaled value is \((400-500)/100=-1\), giving

$$ \lambda_{400}=0.08\exp(0.35)=0.1135\text{ per year}, \qquad P(\text{event by 1 year})=1-\exp(-0.1135)=0.1073. $$

The hazard ratio for 400 versus 600 is \(\exp\{(-0.35)(-1-1)\}=\exp(0.70)=2.014\). The corresponding one-year event probabilities are about 5.48% and 10.7%; their ratio is not 2.014. These are illustrative conditional probabilities under the stated constant-hazard and fixed-CD4 assumptions. For a changing trajectory, the cumulative hazard instead integrates the time-varying hazard over the year.

Model Checks, Alternatives, and Limitations

Diagnostics should address both parts of the model and the link between them. Plot observed CD4 values and fitted trajectories over time, inspect residual patterns and the distributional adequacy of the longitudinal model, and check whether a straight-line trajectory is plausible over the observed follow-up. Examine the event-model fit, including whether the chosen baseline hazard is sufficiently flexible. Sparse measurements, extreme counts, or a few influential participants can make the association estimate unstable. Also check that the fitted model matches the intended endpoint definition, time origin, covariates, and censoring scheme.

An especially important failure mode is to treat the estimated CD4 trajectory as known without uncertainty. In a joint model, uncertainty about the latent trajectory and its association with the event process contributes to inference. A plug-in analysis that first estimates CD4 trajectories and then treats them as exact can understate uncertainty. Conversely, a joint model is not automatically correct merely because it is joint: an implausible trajectory, inadequate event model, or informative visit process can still distort results.

ApproachHow CD4 is usedMain consideration
Joint current-value modelUses a latent CD4 trajectory linked to the event hazardRepresents modeled dependence and accounts for trajectory uncertainty, subject to its assumptions
Separate mixed model and survival modelFits longitudinal and event processes separatelyMay not represent dependence between the processes or event-related loss of later measurements
Time-dependent survival model using observed CD4Uses measured values as time-varying predictorsUses noisy observed values and requires careful handling of measurement timing and availability

The current-value model is one scientifically motivated choice, not the only possible association structure. A slope-based association asks whether the rate of CD4 change is associated with the hazard; a cumulative association asks about accumulated biomarker history. Those choices answer different questions and require their own clinical justification. A current-value association can also be sensitive to the time scale, functional form, and the extent to which the latent CD4 level captures the relevant biology.

Finally, AIDS and death may have different mechanisms, but this composite endpoint treats them alike for the event analysis. The estimated association is an average model-based relationship for the defined endpoint and cohort, conditional on included covariates and assumptions. It does not imply that CD4 alone explains event risk, and it should not be interpreted as evidence that an intervention that raises CD4 would reduce risk by the same amount.

Common Pitfall

Common mistake: “The hazard ratio is 0.705, so a 100-cell higher CD4 count reduces the one-year probability of AIDS or death by 29.5%.”

Correction: The 0.705 is a conditional hazard ratio for a 100-cell higher latent count at a given time. A one-year probability depends on the baseline hazard and the trajectory over the whole year. In addition, this observational model estimates an association, not a causal effect of changing CD4.

Check Your Understanding

Answer each question using the model and units described above. Solutions follow the questions.

  1. If \(\hat{\alpha}=-0.20\), what is the estimated hazard ratio for a 100-cell lower latent CD4 count?
  2. Why is the latent CD4 value \(m_i(t)\) not interchangeable with the observed count \(y_{ij}\)?
  3. What does \(\alpha=0\) imply about the current-value association, conditional on the other modeled terms?
  4. Why can a hazard ratio not be interpreted directly as a ratio of one-year event probabilities?
  5. Name one limitation of treating AIDS and death as a single composite endpoint.

Solutions. (1) The lower-count contrast is \(\exp(-\hat{\alpha})=\exp(0.20)=1.221\), so the estimated hazard is about 1.22 times as large per 100-cell lower count. (2) \(m_i(t)\) is the modeled latent mean trajectory; \(y_{ij}\) is a particular observation that also contains measurement error. (3) Since \(\exp(\alpha)=1\), the model specifies no current-value hazard association per 100-cell difference, holding other terms fixed. (4) Event probability depends on cumulative hazard over the interval, whereas a hazard ratio compares instantaneous hazards; the baseline hazard and any change in CD4 over time also matter. (5) AIDS and death can have different clinical mechanisms, but the composite endpoint does not estimate their associations separately.

Clinical Biostats