Why the Likelihood Must Integrate Over Shared Effects
A subject in a longitudinal-survival study may contribute several omics measurements and either an observed event time or a censoring time. A shared-random-effects model links these sources of information: the same latent subject-specific effects help describe the repeated measurements and the event hazard. The likelihood for that subject must therefore combine both sources conditional on the latent effects, then average over their distribution.
Multiplying a longitudinal likelihood by a survival likelihood evaluated at an estimated random effect is generally not the joint likelihood. It ignores uncertainty about that effect and can distort the contribution, especially when the measurements and event time both provide information about it.
Conditional Models and Their Contributions
Write the longitudinal trajectory as \(m_i(t;b_i)=x_i(t)^\mathsf{T}\beta+z_i(t)^\mathsf{T}b_i\), where \(x_i(t)\) and \(z_i(t)\) are known covariate vectors, \(\beta\) is a fixed-effect vector, and \(b_i\sim N(0,D)\). A common measurement model is
with conditionally independent measurement errors across visits. Thus the conditional longitudinal density is the product of the normal densities. Other measurement distributions can be used when appropriate; the likelihood construction is the same, with those densities substituted.
For illustration, take a proportional hazards model whose hazard depends on the current latent trajectory:
Here \(h_0(t)\) is the baseline hazard, \(w_i\) is a vector of event-model covariates, and \(H_i(t\mid b_i)\) is the cumulative hazard. Conditional on \(b_i\), the event-time contribution for the observed time and event indicator is \(h_i(T_i\mid b_i)^{\delta_i}\exp\{-H_i(T_i\mid b_i)\}\). The hazard factor appears only for an observed event; the survival factor appears for both an event and a censoring time.
Deriving the Subject-Level Joint Likelihood
Conditioning on \(b_i\) makes the factorization possible: the repeated-measurement density multiplies the event-time contribution. Since \(b_i\) is unobserved, the observed-data contribution averages that conditional density over the random-effects distribution.
This follows by the law of total probability: the joint density of observed data is the integral of its conditional density given \(b_i\), multiplied by the density of \(b_i\). The conditional-independence assumptions justify the product inside the integral. Crucially, the integration is over the product of the longitudinal and event contributions. In general, integrating each factor separately and multiplying the resulting marginal contributions would not give the same answer.
A useful equivalent form makes the role of the measurements explicit. Define \(L_{Yi}=\int [\prod_j f_Y(Y_{ij}\mid b_i)]f_b(b_i)\,db_i\), the marginal longitudinal density. The posterior density of \(b_i\) given the measurements is proportional to the longitudinal density times its prior density. Therefore
The expectation is over the distribution of \(b_i\) given \(Y_i\), not over the prior distribution alone. This identity is also a practical way to organize numerical calculations: first account for the longitudinal data, then average the conditional event contribution using the measurement-informed distribution of the random effects.
Worked Example: Building the Conditional Integrand
Consider hypothetical subject \(i\) with two measurements, \(Y_{i1}=1.4\) at time 0 and \(Y_{i2}=1.8\) at time 1. Let \(m_i(t;b_i)=1+0.5t+b_i\), \(\sigma=0.2\), and evaluate the integrand at \(b_i=0.2\). Suppose the baseline hazard is \(h_0(t)=0.1\), there are no additional event covariates, and \(\alpha=0.3\). The subject has an observed event at \(T_i=2\), so \(\delta_i=1\).
At \(b_i=0.2\), the fitted means at the two measurement times are 1.2 and 1.7. The residuals are \(1.4-1.2=0.2\) and \(1.8-1.7=0.1\). The product of the two normal densities is
The trajectory is \(m_i(t;0.2)=1.2+0.5t\), so the hazard varies with time:
At the event time, \(m_i(2;0.2)=2.2\), giving \(h_i(2\mid0.2)=0.1e^{0.66}\approx0.1935\) per time unit. The cumulative hazard is not the endpoint hazard multiplied by 2. It must be integrated over the changing hazard:
Because \(\delta_i=1\), the event contribution is \(0.1935e^{-0.3343}\approx0.1385\). Thus the longitudinal-times-event part of the integrand at \(b_i=0.2\) is approximately \(2.130(0.1385)=0.2950\), before multiplication by the random-effects density. This is one integrand value, not the integrated subject likelihood.
Numerical Integration and Censoring
Except in special cases, the integral over \(b_i\) has no closed form. Gaussian quadrature, adaptive quadrature, or Monte Carlo integration can approximate it. Whatever the numerical method, the target remains the same integral: each evaluation must include the conditional longitudinal density, the event contribution, and the random-effects density. The posterior-expectation form can be convenient when the longitudinal integral and its induced distribution for \(b_i\) are available.
Worked Example: A Censored Subject and Posterior Averaging
For a hypothetical subject with measurements \(Y_i\) and a censoring time \(T_i=2\), suppose numerical integration of the longitudinal model gives \(L_{Yi}=0.2821\) in the measurement-density units. Suppose a two-point, equal-weight quadrature approximation to the distribution of \(b_i\mid Y_i\) gives conditional survival factors \(e^{-H_i(2\mid b)}\) of 0.66656 and 0.90609 at its two support points. Since this subject is censored, \(\delta_i=0\), so there is no hazard-at-\(T_i\) factor.
The posterior average of the survival contribution is
The corresponding joint likelihood approximation is
The result combines the marginal longitudinal density with a survival probability averaged over random effects informed by the measurements. It is not the survival factor at a single estimated random effect.
Worked Example: Distinguishing an Event From Censoring
Use the time-varying hazard from the first example at \(b_i=0.2\) and \(T_i=2\). The calculations give \(h_i(2\mid0.2)\approx0.1935\) per time unit and \(H_i(2\mid0.2)\approx0.3343\). If the subject is censored at time 2, the conditional event-process contribution is
If instead an event is observed at time 2, the contribution is
The event and censoring contributions share the cumulative survival term, but only the observed event contributes a hazard factor. In either case, a full subject likelihood also multiplies by the longitudinal density and integrates over \(b_i\).
Checking the Construction and Choosing a Calculation
Before fitting the model, check that each factor matches the data and assumptions. A useful construction sequence is:
Include one conditional density for each observed assay value, with its actual measurement time and the shared random effect.
Use \(h_i(T_i\mid b_i)^{\delta_i}\exp\{-H_i(T_i\mid b_i)\}\); compute the cumulative hazard by integrating the time-varying hazard.
Multiply both data contributions by \(f_b(b_i)\), and integrate over the full random-effects vector.
Check integration stability and consider whether censoring, measurement timing, or missingness requires an explicit model.
The main computational alternatives differ in how they evaluate the integral. Gaussian quadrature is often efficient for a low-dimensional random-effect vector, while Monte Carlo methods can be more flexible as its dimension grows but may require many draws for stable estimates. A plug-in calculation evaluates the event contribution at an estimated \(b_i\); it is simpler but does not integrate over uncertainty and is not generally equivalent to the marginal likelihood. A conditional likelihood that treats \(b_i\) as known likewise answers a different calculation unless the effects truly are observed.
Diagnostics include comparing likelihood estimates across quadrature orders or integration tolerances, checking convergence from different initial values, and inspecting whether the fitted model reproduces the observed measurement patterns and event-time distribution. A rapidly changing hazard requires careful cumulative-hazard integration; using a constant-hazard shortcut when the model specifies a time-varying hazard is an error. Sensitivity to the random-effects distribution or to the assumed measurement-error structure can also signal that the likelihood is not capturing the data adequately.
- Common mistake: multiplying by the endpoint hazard for censored subjects. A censored subject has \(\delta_i=0\), so the event contribution is survival through the censoring time, not a hazard times survival.
- Common mistake: replacing \(H_i(T_i\mid b_i)\) with \(T_i h_i(T_i\mid b_i)\). That is valid only for a constant hazard over the interval. In general, \(H_i\) is the integral of the hazard over all times up to \(T_i\).
- Common mistake: integrating the two data sources separately and multiplying. Because both depend on the same latent \(b_i\), the correct operation integrates their product, or equivalently averages the event contribution under the measurement-informed distribution of \(b_i\).
The likelihood relies on the stated conditional-independence and censoring assumptions. If visit times or censoring are informative beyond the modeled quantities, or if measurements after an event are structurally unavailable in a way not addressed by the model, additional modeling may be needed. The likelihood construction alone does not establish that those assumptions are appropriate for a particular study.
Check Your Understanding
Answer each question, then compare with the solutions.
- For an observed event, which two event-time factors appear in the conditional contribution?
- A subject is right-censored at time \(c\). What is the event-process contribution conditional on \(b_i\)?
- Why can the measurement and event contributions not generally be integrated separately and then multiplied?
- When can \(H_i(T_i\mid b_i)=T_i h_i(T_i\mid b_i)\) be used?
Solutions. (1) The contribution is \(h_i(T_i\mid b_i)\exp\{-H_i(T_i\mid b_i)\}\): the hazard at the observed event time times survival to that time. (2) It is \(\exp\{-H_i(c\mid b_i)\}\), with no hazard factor because \(\delta_i=0\). (3) Both contributions depend on the same latent \(b_i\), so the integral of their product is generally not the product of their separate integrals. (4) The equality holds when the hazard is constant over the entire interval from 0 to \(T_i\); otherwise the cumulative hazard must be integrated over time.