Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Sharing Random Effects Across Submodels

The Basic Joint Model · Tutorial 128 of 697

Sharing Random Effects Across Submodels

Learn to identify the random-effect directions shared by the two submodels, calculate when they are associated, and distinguish induced association from guaranteed dependence.

Advanced 12 min read

What You'll Learn

  • Write longitudinal and event submodels that use the same subject-specific random effects.
  • Calculate the covariance between a latent marker deviation and the event linear predictor.
  • Explain how the random-effects covariance matrix determines which directions are associated.
  • Use a Gaussian random-effects assumption to relate marker deviations to the event hazard multiplier.
  • Recognize why sharing random effects does not always guarantee association.
  • Compare shared effects with separate effects and observed-marker approaches.

Why Share Random Effects?

A biomarker recorded repeatedly over time can reveal persistent differences between subjects. Some subjects may tend to have higher marker values, or steeper trajectories, than others. If those same subject-specific characteristics also enter the event submodel, a subject’s latent trajectory and event risk can be statistically connected. A shared-random-effects model represents that connection through common latent variables rather than treating each observed biomarker value as an error-free predictor.

The word can matters. Putting random effects in both submodels creates a route through which association may arise, but does not guarantee an association in every direction or at every time. Whether the biomarker’s random component is associated with the event’s random contribution depends on the random-effects covariance structure and on how each submodel uses the random effects.

Definition: In a shared-random-effects joint model, the longitudinal submodel and event submodel contain the same subject-specific random-effects vector \(b_i\), or linear functions of that vector. The random effects are latent: they represent subject-specific departures from the population-level submodels and are not directly observed.

Writing the Shared Structure

Let \(y_{ij}\) be the biomarker measurement for subject \(i\) at time \(t_{ij}\). A standard longitudinal submodel is

$$ y_{ij}=m_i(t_{ij})+\epsilon_{ij}, \qquad m_i(t)=x_i(t)^T\beta+z_i(t)^Tb_i, \qquad b_i\sim N_q(0,D). $$

Here \(m_i(t)\) is the subject-specific latent marker trajectory, \(x_i(t)\) and \(z_i(t)\) are covariate and random-effects design vectors, and \(D\) is the random-effects covariance matrix. The random component of the latent trajectory at time \(t\) is \(U_i(t)=z_i(t)^Tb_i\). For the examples below, measurement error has mean zero and is independent of \(b_i\); this allows us to distinguish the latent trajectory from noise in an observed measurement.

A corresponding event submodel can place a linear function of that same random-effects vector in the log hazard:

$$ h_i(t\mid b_i)=h_0(t)\exp\{\gamma^Tw_i+a^Tb_i\}. $$

In this expression, \(h_0(t)\) is the baseline hazard, \(w_i\) is a vector of event-submodel covariates, and \(a\) is the vector of event-submodel random-effects loadings. The term \(V_i=a^Tb_i\) is the random contribution to the log hazard; the corresponding multiplicative contribution to the hazard is \(\exp(V_i)\). This form isolates the shared-random-effects link. It does not add a current-value term to the event model.

The direction of \(b_i\) used by the longitudinal model at time \(t\) is \(z_i(t)\), while the direction used by the event model is \(a\). The matrix \(D\) describes how random-effects directions co-vary. Consequently, it is not enough to check whether the two submodels contain random effects. One must check whether they use directions that vary together under \(D\).

The Covariance That Reveals the Link

Because \(E(b_i)=0\) and \(\operatorname{Var}(b_i)=D\), the covariance between the longitudinal random component and the event linear predictor is

$$ \operatorname{Cov}\{U_i(t),V_i\} = \operatorname{Cov}\{z_i(t)^Tb_i,a^Tb_i\} = z_i(t)^TDa. $$

This scalar projection is the key calculation. If it is nonzero, the marker’s latent random deviation and the event’s random log-hazard contribution have nonzero covariance. If it is zero, they have zero covariance, but the interpretation depends on the random-effects distribution. Under the Gaussian assumption above, the two linear combinations are jointly normal, so zero covariance implies independence. Without joint normality, zero covariance alone does not generally imply independence.

Under Gaussian random effects, the connection can also be expressed on the hazard-multiplier scale. Since \(V_i\) is normal with mean zero and variance \(a^TDa\),

$$ \operatorname{Cov}\{U_i(t),\exp(V_i)\} = \exp\!\left(\frac{a^TDa}{2}\right)z_i(t)^TDa. $$

Thus, for a Gaussian random-effects distribution, the same directional covariance determines whether the latent marker deviation is associated with the event’s multiplicative hazard contribution. This is an association with the random part of the instantaneous hazard, not a statement that a biomarker causes an event or that the covariance alone fully describes the distribution of event times.

A Short Derivation

To justify the hazard-multiplier result, write \(U=U_i(t)\), \(V=V_i\), and \(c=\operatorname{Cov}(U,V)\). Since \((U,V)\) is jointly normal and \(E(U)=E(V)=0\), for \(\operatorname{Var}(V)>0\),

$$ E(U\mid V)=\frac{c}{\operatorname{Var}(V)}V. $$

Taking the expectation of \(U\exp(V)\) conditional on \(V\), and then averaging over \(V\), gives

$$ \begin{aligned} E\{U\exp(V)\} &=E\{E(U\mid V)\exp(V)\}\\ &=\frac{c}{\operatorname{Var}(V)}E\{V\exp(V)\}. \end{aligned} $$

For a mean-zero normal variable \(V\), its moment-generating function is \(E\{\exp(sV)\}=\exp\{s^2\operatorname{Var}(V)/2\}\). Differentiating with respect to \(s\) and evaluating at \(s=1\) yields \(E\{V\exp(V)\}=\operatorname{Var}(V)\exp\{\operatorname{Var}(V)/2\}\). Also, \(E(U)E\{\exp(V)\}=0\), so the covariance equals \(E\{U\exp(V)\}\). Substitution gives the stated result. If \(\operatorname{Var}(V)=0\), then \(V=0\) with probability one and both sides of the covariance identity are zero.

Worked Example: Checking the Shared Direction

Suppose a hypothetical model has two random effects, with

$$ D= \begin{pmatrix} 0.16&0.02\\ 0.02&0.09 \end{pmatrix}, \qquad z_i(t)= \begin{pmatrix}1\\2\end{pmatrix}, \qquad a= \begin{pmatrix}0.5\\-0.4\end{pmatrix}. $$

Calculate the covariance between the marker’s random component at this time and the event’s random log-hazard contribution. First,

$$ Da= \begin{pmatrix} 0.16(0.5)+0.02(-0.4)\\ 0.02(0.5)+0.09(-0.4) \end{pmatrix} = \begin{pmatrix}0.072\\-0.026\end{pmatrix}. $$

Then

$$ z_i(t)^TDa = (1,2) \begin{pmatrix}0.072\\-0.026\end{pmatrix} = 0.072-0.052=0.020. $$

The marker random component and event random log-hazard contribution therefore have covariance \(0.020\), in the units implied by the chosen random effects and loadings. The value is positive but small relative to the variability of the two components. This calculation establishes a directional covariance; it does not by itself quantify the strength of association on a standardized scale or determine a causal effect.

Worked Example: Nonzero Loadings Do Not Ensure Association

Now suppose \(b_i\sim N_2(0,I)\), \(z_i(t)=(1,0)^T\), and \(a=(0,1)^T\). Both submodels use a nonzero loading, and both random-effect coordinates vary. The marker random component is \(U_i(t)=b_{i1}\), while the event random log-hazard contribution is \(V_i=b_{i2}\). Their covariance is

$$ z_i(t)^TDa = (1,0) \begin{pmatrix}1&0\\0&1\end{pmatrix} \begin{pmatrix}0\\1\end{pmatrix} =0. $$

Because the random effects are jointly normal with identity covariance, \(b_{i1}\) and \(b_{i2}\) are independent. Thus the marker’s random deviation is independent of the event’s random log-hazard contribution, and also of its hazard multiplier \(\exp(b_{i2})\). The fact that both submodels contain nonzero random-effect terms is not enough: the directions are independent in this example.

Worked Example: From Latent Marker to Hazard Multiplier

Consider a hypothetical random-intercept model with \(b_i\sim N(0,0.25)\), latent trajectory \(m_i(t)=10+2t+b_i\), and event hazard \(h_i(t\mid b_i)=0.02\exp(0.8b_i)\) per month. At any time, the latent marker deviation is \(U_i(t)=b_i\), and the event random log-hazard contribution is \(V_i=0.8b_i\). Therefore,

$$ \operatorname{Cov}(U_i,V_i)=0.8(0.25)=0.20. $$

The variance of \(V_i\) is \(0.8^2(0.25)=0.16\). The covariance between the latent marker deviation and the hazard multiplier is consequently

$$ \operatorname{Cov}\{b_i,\exp(0.8b_i)\} = 0.20\exp(0.16/2) = 0.20\exp(0.08) \approx 0.2166. $$

For example, if the observed biomarker is \(y_{ij}=m_i(t_{ij})+\epsilon_{ij}\), with independent mean-zero measurement error, then its covariance with the hazard multiplier is also \(0.2166\): the fixed part of \(m_i(t)\) contributes no covariance, and the independent measurement error contributes none. This is an association with the instantaneous hazard multiplier. It is not the probability of an event in a month, which also depends on the event-time process and its baseline hazard.

Assumptions, Diagnostics, and Alternatives

The covariance calculations rely on a correctly specified random-effects design and covariance matrix, finite second moments, and the same \(b_i\) appearing in both submodels. The hazard-multiplier formula additionally uses jointly Gaussian random effects. In a fitted model, the random-effects covariance matrix must be positive semidefinite; the model’s variance and covariance estimates also need to be plausible for the measurement scale and time units. These are structural and distributional assumptions, not facts guaranteed by observing repeated measurements.

A useful diagnostic is to examine the fitted projection \(z_i(t)^TDa\) over times and covariate patterns relevant to the study. It can change with \(t\), including in sign, when \(z_i(t)\) changes. For random-intercept-and-slope models, for instance, the marker’s direction combines the intercept and slope differently at different times. A single statement such as “the random effects are associated” may therefore conceal which trajectory component, and which time, is involved. Also check whether estimated random-effect variances are near zero or the covariance matrix is nearly singular: in such cases, some directions may be weakly identified, making directional association estimates uncertain.

The shared model is not the only possible approach. The comparison below concerns how each approach represents the link, not which is universally preferable.

ApproachHow it represents the linkMain caution
Shared random effectsUses common latent subject effects in the marker and event submodels.Association depends on the loaded directions and their covariance, not just on sharing a vector.
Separate random effectsUses distinct latent effects for the two submodels.If modeled as independent, it removes the dependence pathway represented by shared effects.
Observed marker as a predictorUses recorded measurements directly in the event model.Recorded values include measurement error and may not represent the latent trajectory accurately.

Shared effects have limitations. Their meaning depends on the chosen random-effects structure, and a poor longitudinal trajectory model can distort the event association. A Gaussian random-effects assumption can also be restrictive; outside the Gaussian case, a zero directional covariance does not rule out other forms of dependence. Finally, statistical association through a latent variable is not evidence that changing the biomarker would change event risk.

Common Pitfall

Wrong reasoning: “The biomarker model and event model both have nonzero random effects, so biomarker values must be associated with event risk.” This overlooks the covariance structure and the directions selected by the two design vectors. In the independent-coordinate example above, both submodels use varying random effects, yet \(z_i(t)^TDa=0\), and the relevant Gaussian components are independent.

Correction: Identify the longitudinal direction \(z_i(t)\), the event direction \(a\), and the covariance matrix \(D\). Calculate \(z_i(t)^TDa\). A nonzero value gives a nonzero covariance for the latent marker deviation and event random log-hazard contribution. A zero value means zero covariance; under joint normality it also means independence of these two linear components, but without that distributional assumption it does not generally establish independence.

Key takeaway: Shared random effects provide a pathway for dependence between longitudinal and event processes. Whether that pathway connects a particular latent marker component to the event’s random risk contribution is determined by the projection \(z_i(t)^TDa\), not merely by the presence of random effects in both submodels.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. For \(D=\begin{pmatrix}0.5&0\\0&0.2\end{pmatrix}\), \(z=(1,1)^T\), and \(a=(0,1)^T\), calculate the covariance between the longitudinal random component and the event random log-hazard contribution.
  2. Under jointly Gaussian random effects, what does a zero value of \(z^TDa\) imply about the two linear random-effect components? What should not be concluded without Gaussianity?
  3. If \(U_i(t)\) is the marker random component and \(V_i=a^Tb_i\), state the formula for \(\operatorname{Cov}\{U_i(t),\exp(V_i)\}\) under the assumptions used in this tutorial.
  4. Why does a nonzero covariance with the hazard multiplier not equal a causal effect of the biomarker on event occurrence?

Solutions. (1) \(Da=(0,0.2)^T\), so \(z^TDa=(1,1)(0,0.2)^T=0.2\). (2) The two components are independent because they are jointly normal and have zero covariance. Without joint normality, zero covariance alone does not establish independence. (3) The covariance is \(\exp(a^TDa/2)z_i(t)^TDa\). (4) It describes statistical association with the model’s random contribution to the instantaneous hazard. It does not establish that intervening on the biomarker changes event risk, and it is not itself an event probability.

Clinical Biostats