Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Constructing a Conditional Subject Likelihood

Maximum Likelihood and EM Estimation · Tutorial 246 of 697

Constructing a Conditional Subject Likelihood

Learn to assemble and check one subject’s conditional likelihood from repeated measurements and event-time data, treating the subject’s random effects as fixed.

Advanced 11 min read

What You'll Learn

  • Write the longitudinal density conditional on a subject’s fixed random effects.
  • Express an event or right-censoring contribution using the conditional hazard and cumulative hazard.
  • Assemble the conditional subject likelihood without integrating over random effects.
  • Check the independence and censoring assumptions behind the factorization.
  • Identify common errors involving censoring, hazard evaluation, and random-effects densities.

Why Construct a Conditional Subject Likelihood?

In a joint model, one subject contributes repeated measurements and an event-time record. Both types of data can depend on the same latent subject-specific random effects. Holding those effects fixed lets us write the subject’s longitudinal and event-time contributions on a common footing: each is a density or likelihood contribution conditional on that same set of effects.

The result is a building block, not yet a likelihood with the random effects removed. In particular, a conditional subject likelihood is a function of the model parameters and the fixed value of the subject’s random effects. It does not average over possible values of those effects.

Definition: For subject \(i\), a conditional subject likelihood is the joint likelihood contribution of that subject’s observed longitudinal measurements and observed event-time record, conditional on the subject’s random effects \(b_i\) and observed covariates. Under the assumptions below, it is the product of the longitudinal density and the event-time contribution, each evaluated at the same \(b_i\).

Model and Assumptions

Suppose subject \(i\) has measurements \(y_{ij}\) at times \(t_{ij}\), for \(j=1,\ldots,n_i\). Write a linear mixed model as \(y_{ij}=x_{ij}^{\mathsf T}\beta+z_{ij}^{\mathsf T}b_i+\varepsilon_{ij}\), where \(\beta\) is a vector of fixed effects, \(b_i\) is a \(q\)-dimensional random-effects vector, and \(x_{ij}\) and \(z_{ij}\) are known design vectors. For the Gaussian example used here, conditional on \(b_i\), the errors are independent with \(\varepsilon_{ij}\sim N(0,\sigma^2)\). Thus the conditional mean is \(m_{ij}(b_i)=x_{ij}^{\mathsf T}\beta+z_{ij}^{\mathsf T}b_i\).

Let \(T_i\) be the event time, \(C_i\) the censoring time, \(Y_i=\min(T_i,C_i)\) the observed time, and \(\delta_i=I(T_i\le C_i)\) the event indicator. Conditional on \(b_i\) and covariates, specify the event hazard \(h_i(t\mid b_i)\), with cumulative hazard \(H_i(t\mid b_i)=\int_0^t h_i(u\mid b_i)\,du\). For example, a current-value association model can use \(h_i(t\mid b_i)=h_0(t)\exp\{w_i^{\mathsf T}\gamma+\alpha m_i(t;b_i)\}\), where \(h_0(t)\) is a baseline hazard, \(w_i\) is a vector of event-model covariates, and \(m_i(t;b_i)\) is the longitudinal model’s latent mean trajectory at time \(t\). The hazard form is part of the specified model; it is not inferred from the observed measurements alone.

The product construction relies on assumptions. The longitudinal errors are conditionally independent across measurement occasions under the stated Gaussian model. Conditional on \(b_i\) and covariates, the longitudinal measurement errors and event-time process are independent, while the event hazard may depend on the latent trajectory through \(b_i\). Censoring is noninformative for the event-time likelihood conditional on the variables being conditioned on, so its distribution contributes no parameter-dependent factor to the likelihood for the event process. The observation schedule is treated as fixed or noninformative under the model. If these assumptions do not hold, the corresponding dependence or observation process may need its own model.

Result: Under these assumptions, the conditional subject likelihood is \(L_i(\theta\mid b_i)=f(y_i\mid b_i;\theta)\,h_i(Y_i\mid b_i;\theta)^{\delta_i}\exp\{-H_i(Y_i\mid b_i;\theta)\}\), where \(y_i=(y_{i1},\ldots,y_{in_i})\) and \(\theta\) collects the model parameters. For the independent Gaussian measurement model, \(f(y_i\mid b_i;\theta)=\prod_{j=1}^{n_i}(2\pi\sigma^2)^{-1/2}\exp\{-[y_{ij}-m_{ij}(b_i)]^2/(2\sigma^2)\}\).

Why the Event-Time Factor Has This Form

For a continuous event time conditional on \(b_i\), the event-time density is the hazard multiplied by the event-free survival probability: \(f_T(t\mid b_i)=h_i(t\mid b_i)S_i(t\mid b_i)\). Since \(S_i(t\mid b_i)=\exp\{-H_i(t\mid b_i)\}\), an observed event at \(Y_i\) contributes \(h_i(Y_i\mid b_i)\exp\{-H_i(Y_i\mid b_i)\}\). A right-censored observation at \(Y_i\) contributes the probability of surviving at least to that time, \(\exp\{-H_i(Y_i\mid b_i)\}\). Both cases are represented by the indicator exponent \(\delta_i\).

The conditional-independence assumption then gives the product of the longitudinal density and this event-time contribution. This is a product of likelihood contributions, not a claim that the observed measurements and event time are unconditionally independent. They can be associated marginally because they share \(b_i\).

$$ L_i(\theta\mid b_i) = \left\{ \prod_{j=1}^{n_i} \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left[-\frac{\{y_{ij}-m_{ij}(b_i)\}^2}{2\sigma^2}\right] \right\} h_i(Y_i\mid b_i)^{\delta_i} \exp\{-H_i(Y_i\mid b_i)\}. $$

Worked Construction

Worked Example: Two Measurements and an Observed Event

Consider a hypothetical subject with a random intercept fixed at \(b_i=0.4\). The longitudinal mean is \(m_i(t;b_i)=10-0.5t+b_i\), and the measurement error standard deviation is \(\sigma=1.2\). Measurements are \(y_{i1}=10.8\) at \(t_{i1}=0\) and \(y_{i2}=9.1\) at \(t_{i2}=2\). Suppose the event occurs at \(Y_i=3\), with hazard \(h_i(t\mid b_i)=0.08\exp\{0.2+0.3[m_i(t;b_i)-10]\}\). Find the conditional subject likelihood.

At the two measurement times, the fitted conditional means are \(10+0.4=10.4\) and \(10-0.5(2)+0.4=9.4\). The residuals are \(10.8-10.4=0.4\) and \(9.1-9.4=-0.3\). Hence the longitudinal density is \((2\pi(1.2)^2)^{-1}\exp\{-[0.4^2+(-0.3)^2]/[2(1.2)^2]\}\). Numerically, this is \((2\pi(1.44))^{-1}\exp(-0.25/2.88)\approx0.1013\).

The latent mean at the event time is \(m_i(3;b_i)=10-0.5(3)+0.4=8.9\). Therefore the event hazard at that time is \(h_i(3\mid b_i)=0.08\exp\{0.2+0.3(8.9-10)\}=0.08\exp(-0.13)\approx0.07025\). The cumulative hazard is \(H_i(3\mid b_i)=\int_0^3 0.08\exp\{0.2+0.3[(10-0.5u+0.4)-10]\}\,du\). The exponent simplifies to \(0.32-0.15u\), so \(H_i(3\mid b_i)=0.08\exp(0.32)[1-\exp(-0.45)]/0.15\approx0.2661\).

Because \(\delta_i=1\), the event-time contribution is \(0.07025\exp(-0.2661)\approx0.05385\). The full conditional subject likelihood is therefore \(L_i(\theta\mid b_i)\approx0.1013(0.05385)=0.005455\). It is a joint density contribution for the two measurements and event time, conditional on \(b_i=0.4\); it is not a probability that the subject has these exact continuous outcomes.

Worked Example: A Right-Censored Subject

For a hypothetical subject, suppose the random effects and covariates yield a constant conditional hazard \(h_i(t\mid b_i)=0.05\exp(0.4b_i)\), with \(b_i=0.5\). The subject is observed event-free until \(Y_i=4\) years, so \(\delta_i=0\). What is the event-time contribution?

The hazard is \(0.05\exp(0.4(0.5))=0.05\exp(0.2)\approx0.06107\) per year. Thus the cumulative hazard through four years is \(H_i(4\mid b_i)=4(0.06107)=0.2443\). Since no event was observed, the contribution is \(h_i(4\mid b_i)^0\exp\{-H_i(4\mid b_i)\}=\exp(-0.2443)\approx0.7832\).

This value is the conditional probability of remaining event-free through four years under the specified constant hazard. It is not multiplied by the hazard at year four: the indicator exponent is zero. Any longitudinal density for this subject would be multiplied by \(0.7832\) to form the complete conditional subject contribution.

Worked Example: Assembling a Censored Subject’s Full Contribution

Suppose a hypothetical subject has one measurement \(y_{i1}=2.2\). Conditional on fixed random effects, its mean is \(2.0\), and \(\sigma=0.5\). The subject is censored at two years under a constant conditional hazard of \(0.1\) per year. Calculate the full conditional subject likelihood.

The longitudinal density is \((2\pi(0.5)^2)^{-1/2}\exp\{-(2.2-2.0)^2/[2(0.5)^2]\}\). Here the normalizing factor is \(1/\sqrt{1.5708}\approx0.7979\), and the exponent is \(-0.04/0.5=-0.08\). The density is therefore approximately \(0.7979\exp(-0.08)=0.7365\).

For censoring at two years, \(H_i(2\mid b_i)=0.1(2)=0.2\), and the event-time contribution is \(\exp(-0.2)\approx0.8187\). Multiplying the two components gives \(L_i(\theta\mid b_i)\approx0.7365(0.8187)=0.6029\). The likelihood contribution combines the observed measurement density with the probability of event-free survival through the censoring time.

What Is Included, and What Is Not?

The conditional likelihood includes the longitudinal density and the event-time factor evaluated at \(b_i\). It does not include the random-effects density. If the random effects are modeled as \(b_i\sim N(0,D)\), then their density is a separate factor in a likelihood that treats the random effects as latent quantities. The distinction matters: adding that density changes the object from a likelihood conditional on \(b_i\) to a joint contribution involving \(b_i\).

The conditional likelihood also differs from the marginal likelihood for the observed data. The latter accounts for uncertainty about the unobserved random effects rather than treating their values as fixed. Its construction requires an additional operation beyond the conditional product; the conditional contribution above is the integrand-level building block, not the result of that operation.

The subject likelihood may be written on the log scale for computation. Taking logarithms converts the product over measurements and the event-time factor into a sum:

$$ \ell_i(\theta\mid b_i) = -\frac{n_i}{2}\log(2\pi\sigma^2) -\frac{1}{2\sigma^2}\sum_{j=1}^{n_i}\{y_{ij}-m_{ij}(b_i)\}^2 +\delta_i\log h_i(Y_i\mid b_i)-H_i(Y_i\mid b_i). $$

This form is useful for checking calculations: the cumulative hazard enters with a minus sign for both events and censored observations, while the log hazard appears only when an event is observed. The expression presumes a positive hazard at an observed event time.

Diagnostics, Alternatives, and Limitations

Several checks can reveal a construction error. Confirm that every measurement mean uses the same \(b_i\) held fixed for the event contribution. Check that \(H_i(Y_i\mid b_i)\) integrates the hazard over the full interval from the time origin to the observed time, and that its value is nonnegative. For an event, the factor must include the hazard at \(Y_i\); for right censoring, it must not. Units provide another check: a hazard has units of inverse time, whereas a cumulative hazard is dimensionless. The event contribution for an exact event time is a density and therefore has units of inverse time; a censoring contribution is a probability and is dimensionless.

A common mistake is to multiply by the event hazard for every subject, including those who were censored. That treats a censoring time as if an event occurred there. The correction is to use \(h_i(Y_i\mid b_i)^{\delta_i}\): when \(\delta_i=0\), the hazard factor is \(1\), and the contribution is survival through \(Y_i\).

Another mistake is to multiply the longitudinal and event-time contributions while silently assuming they are unconditionally independent. The factorization is conditional on \(b_i\) and the modeled covariates. Because both components depend on the same random effects, they need not be independent after those effects are left unconditioned. A third error is to include the random-effects density in a quantity described as conditional on \(b_i\); keep that factor separate.

The main alternative at the next level of analysis is a marginal likelihood that no longer conditions on the random effects. That alternative targets the observed data without treating each \(b_i\) as a fixed known value, but it is not the conditional subject likelihood constructed here. The conditional expression also depends on the chosen longitudinal distribution, hazard model, association structure, and censoring assumptions. For example, correlated measurement errors, informative visit times, or informative censoring can invalidate the simple product unless those processes are represented appropriately.

Key takeaway: For a subject with fixed random effects, multiply the longitudinal density by \(h_i(Y_i\mid b_i)^{\delta_i}\exp\{-H_i(Y_i\mid b_i)\}\). Verify the event indicator, the hazard integral, and the conditioning assumptions before interpreting the result.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. For a right-censored subject with \(Y_i=5\) and \(\delta_i=0\), write the event-time contribution in terms of \(H_i\). Does the hazard at year five appear?
  2. A subject has an event at \(Y_i=2\), with \(h_i(2\mid b_i)=0.3\) per year and \(H_i(2\mid b_i)=0.4\). Calculate the event-time contribution.
  3. For a Gaussian longitudinal model with \(n_i\) conditionally independent measurements, what is the conditional longitudinal density?
  4. Why is a random-effects density not part of the conditional subject likelihood?
  5. Name one assumption that would require extending the simple product of longitudinal and event-time contributions.

Solutions. (1) The contribution is \(\exp\{-H_i(5\mid b_i)\}\); the hazard at year five does not appear because \(\delta_i=0\). (2) It is \(0.3\exp(-0.4)\approx0.2011\) per year. (3) It is the product over \(j=1,\ldots,n_i\) of the normal densities with means \(m_{ij}(b_i)\) and variance \(\sigma^2\). (4) The conditional likelihood treats \(b_i\) as fixed and conditions on its value; the density of \(b_i\) is a separate factor. (5) Examples include informative censoring, informative visit times, or residual dependence not captured by the specified model.

Clinical Biostats