Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Latent Gaussian Representation for INLA

Bayesian Joint Models · Tutorial 331 of 697

Latent Gaussian Representation for INLA

You will learn to map a shared-random-effects joint model into its Gaussian latent field, likelihood factors, and hyperparameters—and to recognize when that representation needs care.

Advanced 11 min read

What You'll Learn

  • Factor a joint likelihood into visit-level and subject-level contributions conditional on shared latent effects.
  • Identify which coefficients and random effects belong in the latent Gaussian field.
  • Distinguish latent variables from hyperparameters such as association and variance parameters.
  • Express a shared-effects survival contribution using a hazard and cumulative hazard.
  • Check Gaussianity, conditional independence, and sparsity assumptions behind the representation.
  • Recognize when nonlinear terms or dependence structures complicate a standard INLA model.

Why the latent Gaussian representation matters

INLA is designed for models with a particular structure: observations have conditionally independent likelihood contributions, while a usually much larger collection of latent variables has a Gaussian distribution conditional on a comparatively small set of hyperparameters. A shared-random-effects joint model can often be arranged in this form. The key is to make explicit which quantities are latent Gaussian variables, which quantities govern their distribution or enter the likelihood as hyperparameters, and which observations are conditionally independent once those quantities are known.

The representation is not a claim that the observed data are jointly Gaussian. The longitudinal outcomes may have a Gaussian likelihood, while survival outcomes contribute a non-Gaussian likelihood. Nor does conditional independence mean that the two outcome processes are marginally independent: they are associated through shared subject-specific latent effects.

Definition: A latent Gaussian model has a latent vector \(x\) whose conditional distribution given hyperparameters \(\theta\) is Gaussian, typically \(x\mid\theta\sim N(\mu(\theta),Q(\theta)^{-1})\), where \(Q(\theta)\) is a precision matrix. Conditional on \(x\) and \(\theta\), the observed data are represented by a product of likelihood contributions. The hyperparameters \(\theta\) may control the latent Gaussian distribution, the observation likelihoods, or both.

A shared-effects model as likelihood factors

Let \(i=1,\ldots,n\) index subjects and \(j=1,\ldots,n_i\) index longitudinal visits for subject \(i\). Write \(y_{ij}\) for the longitudinal outcome measured at time \(t_{ij}\). Let \(T_i\) be the observed follow-up time, the minimum of the event time and censoring time, and let \(\delta_i=1\) indicate an observed event and \(\delta_i=0\) indicate right censoring.

For illustration, consider a Gaussian longitudinal model with a subject-specific random intercept and slope:

$$ y_{ij}=\beta_0+\beta_1t_{ij}+b_{0i}+b_{1i}t_{ij}+\epsilon_{ij}, \qquad \epsilon_{ij}\mid x,\theta\sim N(0,\sigma^2). $$

The subject-specific mean trajectory is \(m_i(t)=\beta_0+\beta_1t+b_{0i}+b_{1i}t\). A proportional-hazards survival model linked to this trajectory can be written

$$ h_i(t\mid x,\theta)=h_0(t)\exp\{\gamma^\mathsf{T}w_i+\alpha m_i(t)\}, $$

where \(w_i\) is a vector of survival covariates, \(h_0(t)\) is the baseline hazard, and \(\alpha\) is the association parameter. Here the survival hazard depends on the latent trajectory through its current value. Other association structures are possible, but the representation must still be checked for compatibility with the intended latent Gaussian formulation.

Conditional on the latent variables and parameters, a longitudinal observation contributes its density \(f_y(y_{ij}\mid x,\theta)\). The survival contribution for subject \(i\) is

$$ L_{Si}(x,\theta) = h_i(T_i\mid x,\theta)^{\delta_i} \exp\left\{-\int_0^{T_i}h_i(u\mid x,\theta)\,du\right\}. $$

This expression combines the event density when \(\delta_i=1\) and the survival probability through \(T_i\) when \(\delta_i=0\). Under the usual conditional independence assumptions, the joint likelihood factors as

$$ p(y,T,\delta\mid x,\theta) = \prod_{i=1}^{n}\left[ \prod_{j=1}^{n_i} f_y(y_{ij}\mid x,\theta) \right]L_{Si}(x,\theta). $$

This factorization states the relevant conditional independence: given the latent variables and parameters, each visit-level contribution and each subject-level survival contribution can be multiplied. Marginally, outcomes from the same subject are generally dependent because they share \(b_{0i}\) and \(b_{1i}\). The standard assumptions include independent subjects conditional on covariates and latent effects, an appropriate longitudinal likelihood, and censoring independent of the event process conditional on the modeled information.

Worked Example: Assigning Model Components to the Latent Field

Suppose there are three subjects, each with two measurements, and each has a random intercept and slope. The baseline hazard is represented by a finite set of Gaussian basis coefficients \(a_1,\ldots,a_K\). The fixed effects and basis coefficients have Gaussian priors. Identify the latent vector and hyperparameters.

One valid latent vector is \(x=(\beta_0,\beta_1,b_{01},b_{11},b_{02},b_{12},b_{03},b_{13},a_1,\ldots,a_K)^\mathsf{T}\). It contains \(2+6+K\) entries: two longitudinal fixed effects, six subject-specific random effects, and \(K\) baseline-hazard coefficients. Each observation then uses the appropriate entries of \(x\) in its likelihood contribution.

The hyperparameters can include the longitudinal residual variance \(\sigma^2\), the random-effects covariance parameters, parameters governing the prior precision of the baseline coefficients, and the association parameter \(\alpha\). A Gaussian prior for the random effects conditional on their covariance parameters makes them part of the latent Gaussian field; the covariance parameters themselves are hyperparameters. The random effects are not replaced by their covariance parameters.

This assignment is valid provided the specified Gaussian priors and likelihood are appropriate and the association parameter is treated in a way that leaves each likelihood contribution evaluable given \(x\) and \(\theta\). In particular, putting \(\alpha\) among the hyperparameters makes the survival predictor linear in the latent trajectory coefficients when \(\alpha\) is held fixed.

What belongs in the latent field, and what belongs in \(\theta\)?

The latent field \(x\) usually includes fixed-effect coefficients with Gaussian priors, subject-level random effects, and any Gaussian latent terms used to represent the baseline hazard or other structured effects. It may also include latent variables that produce a sparse dependence structure, such as a Gaussian Markov random field. The exact contents depend on the model; a quantity is not a latent Gaussian variable merely because it is unknown.

The hyperparameter vector \(\theta\) commonly includes variance or precision parameters, random-effects covariance parameters, parameters controlling Gaussian prior precision matrices, and likelihood parameters. The association coefficient \(\alpha\) is often handled as a hyperparameter. Conditional on a fixed \(\alpha\), the term \(\alpha m_i(t)\) is linear in the coefficients forming \(m_i(t)\). If instead both \(\alpha\) and the random effects are placed in the latent field, their product is nonlinear in the latent variables. That may not fit a standard latent Gaussian predictor and must not be treated as an ordinary linear term without justification.

The conditional Gaussian distribution is often written \(x\mid\theta\sim N(\mu(\theta),Q(\theta)^{-1})\). A useful representation has a sparse precision matrix \(Q(\theta)\): local dependence among random effects or basis coefficients can make the matrix sparse and computations more manageable. Sparsity is a structural property of the chosen representation, not a consequence of merely naming a model “joint.” A dense covariance specification or an unsuitable basis may yield a less convenient precision structure.

Worked Example: Computing a Survival Likelihood Contribution

For a deliberately simple hypothetical case, suppose the baseline hazard is constant at \(0.08\) per day, the covariate term is zero, and the trajectory value entering the hazard is constant at \(m_i(t)=0.4\). Let \(\alpha=0.5\). Subject A has an event at day 10; subject B is censored at day 10. Compute their conditional survival contributions.

The hazard for either subject is \(h_i(t)=0.08\exp(0.5\times0.4)=0.08\exp(0.2)\approx0.09770\) per day. With a constant hazard, the cumulative hazard by day 10 is \(\int_0^{10}h_i(u)\,du=10(0.09770)=0.9770\).

For subject A, \(\delta_A=1\), so \(L_{SA}=0.09770\exp(-0.9770)\approx0.03678\) per day. The units are inverse days because this is an event-time density contribution.

For subject B, \(\delta_B=0\), so \(L_{SB}=\exp(-0.9770)\approx0.3764\). This is the conditional probability of surviving beyond day 10 under the specified hazard. The two contributions differ by the event-hazard factor because only subject A has an observed event.

Why the factorization works

The representation follows from two ingredients: a Gaussian prior model for the latent quantities and a likelihood that separates into the stated conditional contributions. Let \(y\) denote all longitudinal measurements and \((T,\delta)\) all observed survival data. If visits have conditionally independent errors and the survival observations are conditionally independent across subjects, then

$$ p(y,T,\delta\mid x,\theta) = \prod_{i,j}p(y_{ij}\mid x,\theta) \prod_i p(T_i,\delta_i\mid x,\theta). $$

The survival term for a subject depends on that subject’s event information and latent effects, but it does not require an extra joint observation with every longitudinal visit. Combining the likelihood with the latent Gaussian prior gives

$$ p(x\mid y,T,\delta,\theta) \propto p(x\mid\theta) \prod_{i,j}p(y_{ij}\mid x,\theta) \prod_i p(T_i,\delta_i\mid x,\theta). $$

Thus the longitudinal and survival data update the same latent effects through distinct likelihood factors. The prior \(p(x\mid\theta)\) must be Gaussian, and each factor must be a valid likelihood contribution conditional on \(x,\theta\). This derivation does not require the full conditional posterior of \(x\) to be Gaussian; non-Gaussian observation likelihoods generally make it non-Gaussian.

Key result: A shared-random-effects model has a latent Gaussian representation when its unknown latent quantities can be assigned a Gaussian conditional distribution, its remaining parameters can be treated as hyperparameters, and its observed-data likelihood factors conditionally on those quantities. The shared effects create marginal association while preserving conditional likelihood factorization.

Worked Example: Checking Conditional Independence

Suppose one subject has measurements \(y_{i1}\) and \(y_{i2}\), plus a censored survival time \(T_i\). Conditional on the subject’s random intercept and slope, the model specifies independent Gaussian measurement errors and a survival distribution determined by the same trajectory. Is it correct to multiply three contributions?

Yes, if the measurement errors are conditionally independent and censoring is noninformative under the modeled conditioning set. The subject contributes \(f_y(y_{i1}\mid x,\theta)f_y(y_{i2}\mid x,\theta)L_{Si}(x,\theta)\). The shared random effects appear in all three factors, so the contributions are not generally independent after integrating over those effects. The product is a conditional likelihood factorization, not a claim of marginal independence.

If the two measurement errors have residual correlation not represented by \(x\), the first two factors cannot be treated as independent as written. One must instead use their joint conditional likelihood or introduce a suitable latent dependence structure. The assumed factorization must match the data-generating model.

Diagnostics, alternatives, and limitations

Before using this representation, check both the scientific assumptions and the algebraic structure. A useful audit is to write every observation’s conditional distribution and list exactly which entries of \(x\) and \(\theta\) it uses. Then verify that the product of those contributions reproduces the intended joint likelihood.

  • Check conditional independence. Residual correlation across visits, dependence between subjects, or informative censoring may invalidate a simple product unless modeled explicitly.
  • Check Gaussianity of the latent field. A non-Gaussian random-effects distribution is not automatically a Gaussian latent field. Replacing it with a Gaussian approximation changes the model and needs justification.
  • Check nonlinear terms. If an unknown association coefficient multiplies an unknown random effect, identify whether the product is a likelihood function of a hyperparameter and latent field or a nonlinear latent predictor. Do not silently treat it as linear.
  • Check the hazard representation. A baseline hazard model must define valid nonnegative hazards and a well-defined cumulative hazard over follow-up. Its coefficients and prior structure must be included consistently.
  • Check computational structure. Examine whether the chosen latent representation yields a manageable precision structure and whether every likelihood contribution can be evaluated for proposed latent values and hyperparameters.

The main alternative is direct sampling of the joint posterior, for example with MCMC. MCMC can accommodate a broader range of nonlinearities and non-Gaussian latent distributions, but requires sampling and careful chain assessment. INLA is attractive when the model fits the latent Gaussian structure; it does not remove the need to specify the likelihood and prior correctly. Fitting separate longitudinal and survival models is simpler, but generally fails to represent the shared latent effects and the resulting joint association. These approaches answer different computational and modeling needs rather than being interchangeable versions of the same specification.

A representation can also be mathematically valid yet scientifically inadequate. For example, a Gaussian random-effects distribution may poorly describe the population heterogeneity, or a chosen trajectory association may not capture the intended relationship between longitudinal history and event risk. A convenient latent Gaussian form is not evidence that its assumptions are suitable. Model checking and sensitivity analysis remain important.

Common mistake

A frequent error is to say, “The longitudinal and survival outcomes share random effects, so their likelihood contributions are dependent and cannot be factored.” The correction is to distinguish conditional from marginal dependence. Given the shared latent effects and parameters, the contributions may factor under the model’s assumptions; integrating over the shared effects then induces marginal dependence. Conversely, writing a product does not justify conditional independence if residual dependence or informative censoring has been omitted.

Check Your Understanding

Answer each question using the latent-field and likelihood-factorization ideas above.

  1. In a random-intercept model with Gaussian prior, should the subject-specific intercept or its variance parameter belong in the latent field?
  2. Why can visit-level and survival contributions factor conditionally even though the two outcome types are associated marginally?
  3. Suppose an unknown association parameter multiplies a latent random intercept. What representation issue should be checked?
  4. For a censored subject, which part of the survival likelihood contribution remains?

Solutions. (1) The intercept is a latent Gaussian variable; its variance parameter is a hyperparameter governing the latent distribution. (2) Conditional independence permits a product given the shared latent effects and parameters; integrating over those shared effects generally induces marginal dependence. (3) If the association parameter is also latent, the product may be nonlinear in latent variables rather than a standard linear predictor; treating it as a hyperparameter can leave the predictor linear conditional on that parameter. (4) The contribution is the survival probability through the censoring time, \(\exp\{-\int_0^{T_i}h_i(u)\,du\}\), without the event-hazard multiplier.

Clinical Biostats