Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Endoscopic Activity and Surgery in Crohn’s Disease

Case Studies · Tutorial 691 of 697

Endoscopic Activity and Surgery in Crohn’s Disease

Learn how a joint model can relate a patient’s evolving endoscopic activity to bowel-surgery risk, and why assessment schedules and endpoint definitions matter.

Advanced 11 min read

What You'll Learn

  • Specify a longitudinal score model and a time-to-surgery model for the same patients.
  • Interpret a current-value association parameter as a relative hazard, not a causal effect.
  • Work through irregular endoscopy timing and event information in a joint likelihood.
  • Distinguish a defined bowel-surgery endpoint from broader clinical outcomes.
  • Identify when visit timing, score scale, or endpoint choices threaten interpretation.
  • Compare joint modeling with analyses of observed scores alone.

Why the Assessment Schedule and Endpoint Matter

Endoscopic activity scores summarize what is seen during an examination; bowel surgery records an event that may occur months or years later. A clinical question might be whether patients with persistently greater activity have a higher instantaneous rate of surgery. Answering it is not simply a matter of matching each patient’s last score to their surgery time. Examinations may be irregularly spaced, a patient’s disease activity changes between examinations, and an operation is a clinical decision as well as an outcome.

The example below is hypothetical. Let time zero be a defined baseline examination, let \(Y_{ij}\) be patient \(i\)’s endoscopic activity score at examination time \(t_{ij}\), and let \(T_i\) be time from baseline to the first qualifying bowel surgery. The event indicator \(\delta_i\) is 1 if that surgery occurs during follow-up and 0 if follow-up ends first for a specified reason. The endpoint must say which procedures qualify and how deaths or other events are handled.

Definition: A joint model for repeated endoscopic scores and time to bowel surgery specifies (1) a model for the score trajectory over time and (2) a model for the surgery hazard that depends on features of that trajectory. The two parts are linked through patient-specific latent effects or trajectory values, so that uncertainty about a patient’s underlying activity is carried into the event analysis.

For a first illustration, suppose the score is treated as approximately continuous and higher values indicate greater activity. A simple longitudinal submodel is a linear mixed model:

$$ Y_{ij} = \beta_0 + \beta_1 t_{ij} + b_{0i} + b_{1i}t_{ij} + \epsilon_{ij}, \qquad m_i(t)=\beta_0+\beta_1t+b_{0i}+b_{1i}t. $$

Here \(m_i(t)\) is patient \(i\)’s latent mean score at time \(t\); \(b_{0i}\) and \(b_{1i}\) are patient-specific deviations in level and slope, and \(\epsilon_{ij}\) is measurement error. For example, if time is measured in years, \(\beta_1\) and \(b_{1i}\) are in score points per year. A current-value survival submodel is

$$ h_i(t\mid b_i)=h_0(t)\exp\{\gamma^\mathsf{T}X_i+\alpha m_i(t)\}. $$

In this expression, \(h_0(t)\) is the baseline hazard, \(X_i\) contains specified baseline covariates, and \(\alpha\) describes association between latent current activity and the instantaneous hazard of the defined surgery endpoint. The hazard is a rate among patients who have not yet had the endpoint; it is not the probability of surgery by time \(t\). A positive \(\alpha\) means greater latent activity is associated with a higher hazard, conditional on the model and covariates. It does not establish that activity causes surgery.

Assumptions and What the Link Represents

The model is useful only when its assumptions are plausible enough for the intended analysis. The linear score model assumes that the mean trajectory is adequately represented by the chosen time function, that the random effects describe relevant between-patient differences, and that the remaining measurement errors have mean zero and an appropriate variance structure conditional on the model. A linear trend may be a poor description if scores change nonlinearly, have a strong floor or ceiling, or are intrinsically ordinal. In those cases, a flexible time function or an ordinal/count longitudinal model may be more appropriate.

The event model assumes that, conditional on the specified covariates and latent trajectory, the hazard is represented adequately by the chosen association structure and baseline hazard. A current-value link is not the only possible link: a scientific question might instead concern the latent slope, accumulated activity, or a combination. These choices define different associations and should be set before interpreting results. The model also requires a coherent event-time origin, a clear surgery definition, and correct recording of event and censoring times.

The usual joint likelihood assumes that the longitudinal measurements and event time are conditionally independent given the shared patient-specific effects and included covariates. This link can account for association induced by those shared effects. It does not, on its own, make the timing of endoscopies non-informative. If examinations are prompted by worsening symptoms, a patient’s observation process may itself depend on unobserved activity or impending surgery. Ignoring that process can distort the estimated trajectory and its association with surgery.

A further assumption concerns censoring. For a standard single-event survival model, censoring must be independent of the event time conditional on the model variables. If death prevents a later bowel surgery, it is a competing event, not ordinary loss to follow-up. Treating death as independent censoring can misrepresent the probability of surgery; the target must distinguish a cause-specific surgery hazard from the cumulative probability of surgery in the presence of competing events.

How the Joint Likelihood Connects Scores and Surgery

The reason for linking the two model parts can be seen from the likelihood contribution for one patient. Conditional on their random effects \(b_i\), the score data contribute their longitudinal density. The event-time contribution is the hazard at the observed time raised to the event indicator, multiplied by the probability of remaining free of the endpoint up to that time:

$$ L_i(b_i)= \left\{\prod_j f(Y_{ij}\mid b_i)\right\} h_i(T_i\mid b_i)^{\delta_i}S_i(T_i\mid b_i), \qquad S_i(T_i\mid b_i)= \exp\left\{-\int_0^{T_i}h_i(u\mid b_i)\,du\right\}. $$

If surgery occurs, \(\delta_i=1\), and the event contribution is \(h_i(T_i\mid b_i)S_i(T_i\mid b_i)\), the event-time density. If follow-up is censored before surgery, \(\delta_i=0\), and the contribution is only \(S_i(T_i\mid b_i)\). The patient-specific effects are not observed, so the contribution used for estimation averages over their distribution:

$$ L_i=\int L_i(b_i)f(b_i)\,db_i. $$

This integration matters. A patient’s observed scores are noisy measurements of a latent trajectory, and that same trajectory enters the hazard. The event information can therefore inform the estimate of the trajectory, while the observed scores inform the patient-specific activity associated with the event. It is not equivalent to treating a single observed score as error-free.

Worked Example: Estimating a Patient’s Score Trend

Suppose a hypothetical patient has scores of 12, 9, and 6 at 0, 6, and 12 months. For a transparent calculation, fit an ordinary straight line to these three observations, using years as the time unit. This patient-level calculation illustrates the scale of a trend; it is not a substitute for estimating a population mixed model.

The times are \(0\), \(0.5\), and \(1\) year. Their means are \(\bar{t}=0.5\) years and \(\bar{Y}=9\) points. The least-squares slope is

$$ \hat{\beta}_1= \frac{\sum_j(t_j-\bar{t})(Y_j-\bar{Y})} {\sum_j(t_j-\bar{t})^2} = \frac{(-0.5)(3)+(0)(0)+(0.5)(-3)} {(-0.5)^2+0^2+(0.5)^2} = \frac{-3}{0.5} =-6\ \text{points per year}. $$

The fitted intercept is \(\bar{Y}-\hat{\beta}_1\bar{t}=9-(-6)(0.5)=12\) points. Thus the fitted trajectory is \(m(t)=12-6t\), with \(t\) in years. The fitted score at one year is 6 points, matching the final observation. A real analysis would estimate a population trajectory and account for measurement error, between-patient variation, and the actual observation schedule; three observations from one patient cannot establish a general trend.

Worked Example: Interpreting the Current-Value Association

Suppose a hypothetical fitted model estimates \(\alpha=0.18\) per score point. Compare two otherwise similar patients whose latent current scores differ by 5 points. Under the current-value model, the hazard ratio for the patient with the higher score is

$$ \frac{h_{\text{higher}}(t)}{h_{\text{lower}}(t)} = \exp\{\alpha(m_{\text{higher}}(t)-m_{\text{lower}}(t))\} = \exp(0.18\times5) = \exp(0.9) \approx 2.46. $$

Conditional on the model and other included covariates, the patient with the 5-point higher latent score has an estimated instantaneous hazard of the defined surgery endpoint about 2.46 times that of the comparison patient at that time. This is a relative hazard, not a 2.46-fold probability of surgery over a fixed period. The interpretation also depends on the score scale: \(\alpha\) is per score point, and rescaling the score changes its numerical value.

Assessment Timing Is Part of the Analysis

Endoscopic examinations need not occur at evenly spaced visits. Suppose a patient is assessed at baseline and month 4, then not again until month 15. A model can use the recorded times directly; it should not pretend that the month-4 score was measured at month 12. Between examinations, the estimated \(m_i(t)\) is model-based interpolation or extrapolation, and its uncertainty generally grows as the gap from observed data increases.

Timing can also be informative. If symptoms lead clinicians to schedule an earlier examination, patients with high or worsening activity may have more measurements near a period of clinical deterioration. A standard joint score-and-surgery model accounts for the association between the measured score trajectory and surgery through its shared effects, but does not automatically model why each examination occurred when it did. Useful checks include plotting assessment times by follow-up and event status, comparing visit frequency across observed activity levels, and examining whether the schedule changes near surgery. If the observation process plausibly depends on unobserved activity, a model for visit intensity or a sensitivity analysis may be needed.

Surgery also ends the opportunity to observe later scores. This is not ordinary missingness that can be fixed by carrying the last score forward. In a joint model, the event contribution uses the patient’s survival history up to surgery, while their observed scores contribute information on the trajectory before the event. Post-surgery scores should not be treated as if they were pre-surgery observations of the same untreated course.

Worked Example: How the Surgery Definition Changes a Rate

Consider a hypothetical group contributing 40 patient-years at risk before the first qualifying event or end of follow-up. Three first bowel procedures occur: two resections and one non-resection bowel operation. Compare two clearly specified endpoints: (A) any first bowel operation and (B) first bowel resection only. For this crude illustration, treat other follow-up endings as censoring, and assume the 40 patient-years are calculated to each patient’s first endpoint or censoring time.

For endpoint A, the crude event rate is \(3/40=0.075\) operations per patient-year, or 7.50 per 100 patient-years. For endpoint B, it is \(2/40=0.050\) resections per patient-year, or 5.00 per 100 patient-years. The broad endpoint’s crude rate is \(0.075/0.050=1.50\) times the resection-only rate in this example because it counts one additional event.

These are descriptive rates, not adjusted hazard ratios and not estimates of a causal effect. The broader endpoint may capture more clinical decisions, but it combines procedures that may have different indications. The narrower endpoint is more specific to resection but omits other operations. A joint model’s event association can therefore change when the endpoint changes, even if the score data are identical. The endpoint and handling of death must be stated before interpreting any estimated association.

Diagnostics, Alternatives, and Limitations

A credible analysis checks both model components and the connection between them. For the score model, inspect observed-versus-fitted trajectories, residual patterns over time, the distribution of residuals, and whether fitted values systematically miss high or low scores. Look for floor or ceiling effects and score distributions inconsistent with a Gaussian error model. For the event component, assess whether the baseline hazard and covariate form are adequate, and check whether the chosen current-value association is plausible. Compare predicted and observed event patterns at clinically relevant times where possible.

The assessment schedule deserves its own diagnostic review: tabulate the number and timing of examinations, compare them by eventual surgery status, and identify large gaps or clusters of visits. A model may converge and still be poorly identified if there are few surgeries, little score variation, or sparse scores close to the event. Wide uncertainty intervals, sensitivity to the time function or endpoint definition, and unstable estimates are warnings against strong conclusions. Extrapolating a latent trajectory far beyond a patient’s last examination is particularly uncertain.

ApproachWhat it usesMain concern
Time-dependent survival model using observed scoresRecorded scores as time-varying covariatesScores are measured with error and only at examination times; carrying values forward can misrepresent changing activity.
Separate longitudinal and survival analysesA score model and an event model fitted independentlyDoes not fully propagate uncertainty in the latent trajectory into the event association.
Joint modelRepeated scores and event history linked through latent effects or trajectory valuesDepends on assumptions about both processes and does not by itself solve informative examination timing or endpoint ambiguity.

A joint model is most helpful when repeated scores are noisy and their underlying trajectory is meaningfully associated with event risk. It is not automatically preferable in every dataset. A simple time-dependent model may be adequate for a question about the association with the most recently observed score, provided its measurement and timing limitations are explicit. A joint model can also be fragile when there are few events relative to model complexity. Neither approach turns an observational association into a causal effect: treatment changes, clinician decisions, comorbidities, and unmeasured severity may affect both scores and surgery.

Finally, endoscopic activity and bowel surgery are different kinds of information. The score is an intermittently observed assessment; surgery is a time-to-event outcome influenced by disease, patient preferences, treatment response, access to care, and clinical judgment. A conclusion should name the modeled score, time scale, surgery endpoint, follow-up population, and association scale. “Higher latent activity was associated with a higher hazard of the specified surgery endpoint” is more defensible than saying that the score predicts or causes surgery without qualification.

Common pitfall: Treating the last observed endoscopic score as the patient’s true activity until surgery, then interpreting a regression coefficient as a causal effect. The correction is to distinguish noisy observed scores from the latent trajectory, model event time using an explicitly defined endpoint, and describe the resulting association as conditional on the model—not as proof of causation.

Check Your Understanding

Answer each question, then compare with the concise solutions below.

  1. If \(\alpha=0.12\) per score point, what is the modeled hazard ratio for a 4-point difference in latent current score?
  2. Why does an examination prompted by worsening symptoms create a concern even when the joint model includes a shared random intercept?
  3. In a current-value model, what does \(\delta_i=0\) contribute to the event-time likelihood?
  4. Give one reason why an endpoint of any bowel operation may produce a different association from an endpoint of resection only.
  5. Why is it inappropriate to interpret \(\exp(\alpha\Delta)\) as the ratio of fixed-period surgery probabilities?

Solutions. (1) \(\exp(0.12\times4)=\exp(0.48)\approx1.62\), so the modeled instantaneous hazard is about 1.62 times higher for the patient with the higher score, conditional on the model. (2) A shared random intercept links a patient’s score level and event hazard, but does not model why or when examinations are scheduled; symptom-triggered timing may depend on current, possibly unobserved activity. (3) It contributes the survival probability \(S_i(T_i\mid b_i)\), since the patient remained free of the endpoint through the censoring time. (4) The broader endpoint includes procedures with potentially different indications and may count events excluded by a resection-only definition, changing which events contribute to the hazard. (5) The expression is a hazard ratio at a given time, conditional on the model; fixed-period probabilities also depend on the baseline hazard, follow-up time, and survival up to that time.

Clinical Biostats