Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › End-to-End Joint-Model Workflow for a Biomarker Cohort

Software and Workflow · Tutorial 667 of 697

End-to-End Joint-Model Workflow for a Biomarker Cohort

Work through a hypothetical biomarker cohort from data checks to a defensible joint-model report, including how to verify that the fitted model matches the scientific question.

Intermediate 11 min read

What You'll Learn

  • Organize irregular biomarker measurements and event follow-up into linked subject-level and visit-level data.
  • State the assumptions needed for a shared-random-effects joint model with right censoring.
  • Translate a scientific question into longitudinal and event submodels and a current-value association.
  • Check convergence, model specification, parameter scales, and sensitivity to numerical settings.
  • Report an association estimate with a correct interpretation and explicit limitations.

From Cohort Records to a Joint-Model Result

A joint model is only useful when its fitted version corresponds to the cohort that was actually observed and to the scientific question being asked. In a biomarker cohort, this means keeping measurement times, event times, censoring indicators, and subject identifiers aligned; specifying how the evolving biomarker enters the event hazard; and checking that the software fitted those choices rather than a nearby alternative. The workflow below uses a hypothetical cohort with irregular measurement times and right-censored follow-up.

The focus is on carrying out and auditing a complete analysis, not on comparing association structures or software packages. Earlier material on preparing longitudinal and event tables, specifying submodels, and interpreting software summaries supplies the detailed options; here those decisions are connected into one auditable sequence.

Definition: For subject \(i\), let \(y_{ij}\) be the biomarker measurement at time \(t_{ij}\), and let \(Y_i=\min(T_i,C_i)\) be the observed follow-up time, where \(T_i\) is the event time and \(C_i\) is the censoring time. Let \(\delta_i=1\) if the event is observed and \(\delta_i=0\) if follow-up is right-censored. A joint model specifies a longitudinal model for the repeated measurements and an event model whose hazard depends on the subject-specific latent biomarker trajectory.

Assumptions to Establish Before Fitting

A standard shared-random-effects model can be written as

$$ y_{ij}=m_i(t_{ij})+\epsilon_{ij}, \qquad m_i(t)=X_i(t)^\mathsf{T}\beta+Z_i(t)^\mathsf{T}b_i, \qquad b_i\sim N(0,D), $$

where \(m_i(t)\) is the subject-specific latent biomarker trajectory, \(X_i(t)\) and \(Z_i(t)\) are specified covariate vectors, and \(\epsilon_{ij}\) is measurement error. For a current-value association, one possible event submodel is

$$ \lambda_i(t\mid b_i)=\lambda_0(t)\exp\{\gamma^\mathsf{T}w_i+\alpha m_i(t)\}. $$

Here \(w_i\) contains event-model covariates and \(\lambda_0(t)\) is the baseline hazard. The coefficient \(\alpha\) describes the association between the latent current biomarker value and the event hazard, conditional on the included covariates and the model. Its units depend on the biomarker scale.

The model relies on more than a choice of formulas. The trajectory and hazard forms must be adequate for the data; the random-effects and measurement-error distributions must be reasonable; and the two submodels must use a coherent time origin and compatible covariates. A common likelihood-based analysis also assumes that censoring is non-informative conditional on the modeled information, so the censoring process can be omitted from the likelihood. The visit process must likewise be non-informative for the analysis, or otherwise modeled: for example, visit timing should not carry unaccounted information about the event or latent biomarker. These assumptions are scientific and design assumptions, not conclusions established by successful software execution.

Prepare and Verify the Two Data Tables

Keep a visit-level table with one row per observed biomarker measurement and a subject-level event table with one row per person. Link them by a stable subject identifier. For each subject, verify that measurement times use the same origin and units as event follow-up, that values are numeric and correctly recorded, and that no measurement is after the subject's observed endpoint unless the study design explicitly permits it. Check for duplicate subject-time records and inconsistent event indicators. Do not create artificial visits to make the data rectangular: irregular spacing is part of the observed design.

Worked Example: Auditing a Small Hypothetical Cohort

Suppose five hypothetical subjects are followed from enrollment. Biomarker values are recorded in units, and times are in years since enrollment. The following compact record lists each subject's measurements followed by observed follow-up and event status.

SubjectBiomarker measurements (time, value)Observed follow-up \(Y_i\) (years)\(\delta_i\)
A(0, 52), (2, 48), (5, 42)61
B(0, 60), (1, 58), (4, 55)70
C(0, 45), (3, 47)41
D(0, 70), (2, 66), (6, 63)80
E(0, 50), (1, 46), (2, 44)31

The data are internally ordered: every listed measurement time is at or before that subject's observed follow-up. For example, subject E has a measured value at year 2 and an event at year 3; subject B is censored at year 7 after the last listed measurement at year 4. A visit at year 5 for subject B must not be invented, and the absence of such a visit is not itself a biomarker value. Before fitting, the analyst would also verify that the event indicator is coded consistently, that the identifiers match across tables, and that event times are not accidentally stored in a different unit.

Specify the Analysis Before Running It

Write down the intended analysis in words and formulas before passing data to software. For example: use years since enrollment; fit a linear latent trajectory with subject-specific intercept and slope; use a Weibull baseline hazard; adjust the event submodel for treatment group; and associate the event hazard with the current latent biomarker value. This makes the software call auditable. It also makes clear what is not being estimated: a current-value model does not automatically estimate a slope association or cumulative exposure effect.

For a linear trajectory, the specification might be

$$ m_i(t)=\beta_0+\beta_1t+b_{0i}+b_{1i}t, \qquad \lambda_i(t\mid b_i)=\lambda_0(t)\exp\{\gamma_1 w_i+\alpha m_i(t)\}. $$

The shared random effects connect the two outcomes: subjects with different latent trajectories can have different hazards through \(m_i(t)\). The model does not assert that a biomarker intervention would cause a change in event risk. The estimated association is conditional on the model and can reflect confounding or other features of the cohort.

Worked Example: Checking the Meaning and Scale of an Association

Consider a hypothetical fitted output from a sufficiently large cohort, not from the five-subject table above. Suppose the estimated current-value association is \(\hat{\alpha}=0.080\) per biomarker unit, with standard error \(0.025\). A Wald 95% interval on the coefficient scale is

$$ 0.080\pm1.96(0.025) =0.080\pm0.049 =(0.031,\ 0.129). $$

Because the link is log-hazard, a 10-unit increase in latent current biomarker value corresponds to the hazard ratio

$$ \exp(10\hat{\alpha})=\exp(0.80)=2.226. $$

Transforming the coefficient interval in the same way gives

$$ \bigl(\exp(10(0.031)),\exp(10(0.129))\bigr) =(\exp(0.31),\exp(1.29)) =(1.363,\ 3.633). $$

Under this model, and conditional on the included event covariates, a 10-unit higher latent current biomarker value is associated with an estimated 2.23-fold event hazard; the Wald 95% interval is 1.36 to 3.63. This is an association in the modeled hazard, not a statement that changing the biomarker would cause that hazard change. The interval describes uncertainty under the fitted model and its assumptions.

Fit, Then Check What Was Actually Fitted

The observed-data likelihood clarifies why both data tables and both submodels matter. Conditional on random effects, the longitudinal contribution is the density of all observed measurements, while the event contribution combines the event hazard (when an event is observed) with survival through the observed follow-up time. The subject-level contribution is integrated over the random-effects distribution:

$$ L_i= \int \left\{\prod_j f(y_{ij}\mid b_i)\right\} \left\{\lambda_i(Y_i\mid b_i)^{\delta_i} \exp\!\left(-\int_0^{Y_i}\lambda_i(u\mid b_i)\,du\right)\right\} \phi(b_i;0,D)\,db_i. $$

This expression assumes the stated conditional models and non-informative censoring. A censored subject contributes the survival term through \(Y_i\), but no event-hazard factor at \(Y_i\). The random effects are integrated out because they are unobserved. This is the central reason separate longitudinal and survival fits do not generally reproduce a joint-model fit.

After fitting, compare the software output with the written specification rather than treating a completed run as proof of correctness. Check the subject and measurement counts; the event count; time origin and scales; fixed and random effects; baseline hazard; association structure; covariates; and reference categories. Inspect convergence messages, gradient or convergence criteria, parameter estimates and standard errors, random-effects covariance estimates, and whether estimates change materially when numerical integration or optimizer controls are tightened. A positive-definiteness problem, a boundary variance estimate, or large changes across reasonable numerical settings calls for investigation.

Worked Example: A Post-Fit Consistency Check

Suppose a hypothetical run was intended to use the current-value model above with a linear time trajectory and Weibull baseline hazard. The output reports an association coefficient \(\hat{\alpha}=0.08\), a positive estimated random-intercept variance of \(16\), a positive random-slope variance of \(0.09\), and a random-intercept/random-slope correlation of \(-0.30\). The implied covariance is

$$ \widehat{\operatorname{Cov}}(b_{0i},b_{1i}) =(-0.30)\sqrt{16}\sqrt{0.09} =(-0.30)(4)(0.30)=-0.36. $$

The associated \(2\times2\) estimated covariance matrix is

$$ \widehat D= \begin{pmatrix} 16 & -0.36\\ -0.36 & 0.09 \end{pmatrix}, \qquad \det(\widehat D)=16(0.09)-(-0.36)^2=1.44-0.1296=1.3104>0. $$

Both variances are positive and the determinant is positive, so this reported matrix is positive definite. That is a useful consistency check, not proof that the trajectory is adequate or the model has converged. The analyst must still verify that the output labels the association as current value, reports the intended Weibull baseline and covariates, and shows satisfactory convergence. If the output instead labels the association as a slope effect, the numerical estimate cannot be interpreted as the intended current-value association, even if the run completed without warnings.

Diagnostics, Alternatives, and Limits

A practical diagnostic review asks whether the model is stable numerically and plausible scientifically. Plot observed biomarker values against time, including subject-level patterns, to identify gross curvature, outliers, and sparse follow-up. Examine whether the fitted longitudinal component captures important trends and whether residual variation or subject-specific trajectories show systematic structure. Review event counts and follow-up patterns, and assess whether the event model adequately represents the observed risk pattern. Where feasible, compare reasonable trajectory or baseline-hazard specifications and check whether the association estimate is sensitive to numerical integration settings. Such checks can reveal incompatibility; no single diagnostic certifies the model assumptions.

The main alternatives answer different questions. Separate longitudinal and survival models do not account for their shared subject-level latent trajectory in the same way. A time-dependent Cox model using the most recently observed biomarker treats that observed value as the covariate and can be sensitive to measurement error and irregular visit timing. Landmark analysis estimates risk from a chosen landmark among people still at risk there, rather than fitting the same full joint likelihood. These approaches can be useful, but their estimands and assumptions differ; they are not interchangeable sensitivity settings for one identical model.

Joint models also have limits. Results can be sensitive to trajectory shape, association structure, random-effects distribution, informative visit processes, and unmeasured confounding. Sparse measurements or few events can make estimates imprecise, while complex models may be weakly identified. A good fit does not remove these limitations or establish a causal effect. Report the cohort definition, time scale, censoring definition, model formulas, estimation method and relevant numerical settings, key estimates with uncertainty and units, diagnostics, and important assumptions.

1
Define the target analysis.
State the population, time origin, event, biomarker scale, covariates, trajectory, and association structure.
2
Audit the linked records.
Check identifiers, time ordering, units, event indicators, duplicates, and measurement timing relative to observed follow-up.
3
Fit the specified model.
Use an estimation method supported by the intended structure and record numerical settings and warnings.
4
Verify and report.
Match output to the written model, assess stability and fit, interpret estimates on the correct scale, and state limitations.
Common pitfall: A successful software run is not evidence that the intended model was fitted. For instance, an analyst may see a nonzero association estimate and report it as a current-value effect even though the fitted formula used the biomarker slope. The correction is to compare the reported association structure and every submodel term with the prewritten specification before interpreting any coefficient.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. A subject is censored at year 5 and has biomarker visits at years 0, 2, and 4. What event contribution does this subject make at year 5?
  2. Why should an unobserved visit at year 3 not be entered as a biomarker value?
  3. In a current-value model, what does \(\exp(5\alpha)\) represent when the biomarker is measured in units?
  4. Name two checks that can reveal a mismatch between the intended model and software output.

Solutions. (1) With \(\delta_i=0\), the conditional event contribution is survival through year 5, \(\exp\{-\int_0^5\lambda_i(u\mid b_i)\,du\}\); there is no event-hazard factor at year 5. (2) No measurement was observed there, so entering a value would fabricate data and could alter the longitudinal likelihood. (3) It is the hazard ratio associated with a 5-unit higher latent current biomarker value, conditional on the model covariates and assumptions. (4) For example, compare the reported association type with the intended current-value structure, and verify the baseline hazard, time scale, covariates, random effects, and event count against the written specification.

Clinical Biostats