Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Diagnosing Time-Local Association Misspecification

Model Diagnostics · Tutorial 612 of 697

Diagnosing Time-Local Association Misspecification

Learn how to construct and interpret a time-local score diagnostic that tests whether recent biomarker deviations align with event excesses or deficits during follow-up.

Advanced 12 min read

What You'll Learn

  • Define recent biomarker residual summaries using measurements available before each event time.
  • Derive a window-specific score for an added residual-by-time association term.
  • Calculate weighted residual summaries, score contributions, and predictable quadratic variation.
  • Distinguish directional diagnostic evidence from a calibrated significance test.
  • Recognize when risk-set, censoring, residual-estimation, or multiple-window issues undermine interpretation.
  • Compare the time-local score with broad residual trends and posterior predictive checks.

Why Look for Association Misspecification in Time Windows?

A joint model can fit the overall relationship between a biomarker and event risk reasonably well while missing when that relationship is most apparent. For example, a model using the current fitted biomarker value might understate risk after a recent biomarker deviation, or the assumed association might work early in follow-up but not later. A time-local diagnostic asks whether recent biomarker residuals and event residuals align unusually within a specified part of follow-up.

The diagnostic is a targeted check, not a search for a causal effect. Its interpretation depends on the fitted longitudinal and event components, the construction of the residual summary, and the risk set at each time. The earlier material on association-link residuals provides the broader residual-association context; here the emphasis is on localizing possible lack of fit in time.

Model and Time-Local Residual Summary

Let \(Y_{ij}\) be the biomarker measurement for subject \(i\) at time \(t_{ij}\), and let \(m_i(t)\) be the fitted latent mean trajectory under the longitudinal component. A standardized longitudinal residual at a measurement time can be written \(r_{ij}=\{Y_{ij}-\widehat m_i(t_{ij})\}/\widehat\sigma\), where \(\widehat\sigma\) is the fitted residual standard deviation. Thus \(r_{ij}\) is measured in residual standard-deviation units.

For a diagnostic at time \(t\), summarize only measurements observed strictly before \(t\). One example is an exponentially weighted recent residual average:

$$ q_i(t)= \frac{\sum_{j:t_{ij}<t}\exp\{-\kappa(t-t_{ij})\} \,I(t-\Delta\le t_{ij})\,r_{ij}} {\sum_{j:t_{ij}<t}\exp\{-\kappa(t-t_{ij})\} \,I(t-\Delta\le t_{ij})}, $$

where \(\kappa>0\) controls how quickly older measurements lose weight, \(\Delta>0\) defines the recent-history window, and \(I(\cdot)\) is the indicator function. Define \(q_i(t)\) only when at least one eligible measurement is available. A positive value means that recent biomarker observations tend to be above the fitted trajectory; a negative value means they tend to be below it. Other prespecified summaries, such as a recent residual slope, are possible, but they answer different diagnostic questions.

Let \(N_i(t)\) count subject \(i\)'s events by time \(t\), and let \(Y_i(t)\) indicate whether that subject is still under observation and at risk just before \(t\). Under a fitted joint model, write the conditional event hazard as

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

where \(b_i\) denotes the subject-specific latent effects, \(w_i\) denotes event-component covariates, and \(g_i(t)\) is the fitted biomarker association representation, such as the current latent value. This diagnostic does not replace that association term. It checks whether adding a local contribution from \(q_i(t)\) would improve the event component in a selected time window.

Definition: For a prespecified follow-up window \(W\), let \(a_W(t)=I(t\in W)\). The time-local association score is the score, evaluated under the fitted model with no added residual association, for an alternative hazard containing the term \(\beta_W a_W(t)q_i(t)\). A large signed score indicates weighted alignment or reverse alignment between recent biomarker residuals and event residuals within \(W\).

Derivation and Assumptions

For the derivation, temporarily treat the latent effects and model parameters as known. Suppose the alternative conditional hazard is \(h_i(t\mid b_i)\exp\{\beta_W a_W(t)q_i(t)\}\). The event-process log likelihood, omitting terms not involving \(\beta_W\), is

$$ \ell(\beta_W)= \sum_i\left[ \int \beta_W a_W(t)q_i(t)\,dN_i(t) -\int Y_i(t)h_i(t\mid b_i) \exp\{\beta_W a_W(t)q_i(t)\}\,dt \right]. $$

Differentiating with respect to \(\beta_W\) and setting \(\beta_W=0\) gives

$$ U_W= \left.\frac{\partial\ell(\beta_W)}{\partial\beta_W}\right|_{\beta_W=0} = \sum_i\int a_W(t)q_i(t) \{dN_i(t)-Y_i(t)h_i(t\mid b_i)\,dt\}. $$

The expression in braces is the event martingale increment under the correctly specified null model. In this known-parameter, conditional formulation, its mean is zero given the relevant past history. A positive score is evidence of positive weighted alignment: for example, positive \(q_i(t)\) paired with an event excess, and/or negative \(q_i(t)\) paired with an event deficit. A negative score reflects the reverse alignment. The score's sign alone does not say which pattern produced it; inspect its time- and subject-specific contributions.

This derivation relies on a correctly specified null hazard and risk process, conditionally independent censoring given the modeled history, and a predictable \(q_i(t)\): its value at time \(t\) must be computable from information available before \(t\). The longitudinal residual summary should also be meaningfully standardized and its construction prespecified. Using future biomarker measurements to calculate a residual summary at an earlier time can break predictability and create misleading alignment.

In practice, latent effects and parameters are estimated, and subject-specific hazards are not directly observed. A marginal joint-model score accounts for latent effects by integrating over their distribution; equivalently, an observed-data score can be formed by taking the conditional expectation of the complete-data score given the observed data. Plugging in estimated effects and hazards is a useful exploratory approximation, but its uncertainty must account for parameter estimation, latent-effect uncertainty, and the fact that \(q_i(t)\) is itself constructed from data.

Worked Calculations

Worked Example: A Recent Residual Average

Suppose a hypothetical subject is assessed at \(t=5\), with \(\kappa=1\) per time unit and a recent window wide enough to include measurements at \(t=3.5\) and \(t=4.5\). The standardized residuals are \(1.0\) and \(-0.5\), respectively. Their exponential weights are \(\exp(-1.5)=0.2231\) and \(\exp(-0.5)=0.6065\).

The weighted average is \(q_i(5)=\{0.2231(1.0)+0.6065(-0.5)\}/(0.2231+0.6065)\). Keeping the numerator and denominator unrounded until division, \(q_i(5)=(0.2231-0.30325)/0.8296\approx-0.0966\).

The recent residual summary is slightly below zero in standardized units: the more recent negative residual receives more weight than the older positive residual. This value is a diagnostic covariate, not an estimate of the biomarker level or a hazard ratio.

Worked Example: Summing Window-Specific Score Contributions

Consider a hypothetical follow-up window with three short intervals, each containing one subject at risk. Suppose the fitted expected event counts in the intervals are \(0.30\), \(0.20\), and \(0.40\), and the recent residual summaries are \(0.8\), \(-0.4\), and \(0.5\). The observed event counts are \(1\), \(0\), and \(0\), respectively. Since all intervals are in \(W\), \(a_W(t)=1\).

For an interval, the score contribution is \(q_i(t)\{\text{observed event count}-\text{fitted expected count}\}\). The contributions are \(0.8(1-0.30)=0.56\), \((-0.4)(0-0.20)=0.08\), and \(0.5(0-0.40)=-0.20\). Therefore \(U_W=0.56+0.08-0.20=0.44\).

The net score is positive. The first interval contributes positive alignment because a positive residual summary accompanies an event excess. The second also contributes positive alignment because a negative summary accompanies an event deficit. The third contributes in the opposite direction: a positive summary accompanies an event deficit. The total \(0.44\) is descriptive until an appropriate uncertainty calculation is supplied.

Worked Example: Predictable Quadratic Variation

Use the three intervals above. With known parameters, the predictable quadratic variation of this score martingale is the integrated squared weight against the fitted event intensity. For these interval summaries, the corresponding quantity is \(V_W=(0.8)^2(0.30)+(-0.4)^2(0.20)+(0.5)^2(0.40)\).

The arithmetic is \(V_W=0.192+0.032+0.100=0.324\). This is the realized predictable quadratic variation (the bracket) for the stated fitted intensities and summaries. It is not generally the unconditional variance of \(U_W\): under the usual square-integrability conditions, \(\operatorname{Var}(U_W)=\mathbb E[V_W]\) when the score has mean zero. The bracket can itself be random when risk processes or summaries are random.

One could form the exploratory ratio \(0.44/\sqrt{0.324}\approx0.773\), but it is not automatically a calibrated test statistic. In particular, these data are tiny, parameters are typically estimated, and latent effects and residual construction add uncertainty. A formal reference distribution requires a suitable score-test derivation or resampling calibration for the fitted joint model.

Interpreting Patterns and Checking the Diagnostic

A useful assessment starts with a plot over follow-up of the recent residual summaries and event-residual contributions, alongside the chosen window boundaries. Individual martingale residual increments can be positive or negative; the score weights them by \(q_i(t)\), so a cumulative score curve can reveal when alignment accumulates. Examine whether the signal is concentrated in a few subjects, whether it changes sign, and whether the chosen window has adequate risk-set support.

The window should have a scientific or modeling rationale. If many windows, decay rates, or residual summaries are tried and only the largest score is reported, chance selection can make the apparent evidence too strong. Prespecify a small set of windows or calibrate the maximum over the search, for example by simulating or bootstrapping under the fitted null and repeating the entire search and model-fitting procedure.

Common warning signs include too few at-risk subjects in part of the window, sparse biomarker measurements, unstable residual summaries, and abrupt changes in observation or censoring patterns. Also check whether a broad time-varying hazard problem could explain the apparent association signal: a misspecified baseline hazard or omitted time-varying covariate can induce event residual patterns that correlate with biomarker residuals. The event-process assumptions and censoring model therefore matter, not only the longitudinal residuals.

How This Check Differs From Alternatives

ApproachPrimary questionWhat it does not establish
Time-local residual scoreDo recent biomarker deviations align with event excesses or deficits in a specified window?It does not identify a causal mechanism or prove the fitted association form is wrong.
Global association-link residual checkIs there broad evidence against the chosen association representation?A global summary may conceal when a discrepancy occurs.
Time-varying hazard residual checkDoes the event component show time-patterned misfit overall?A time pattern alone does not show that biomarker residuals explain it.
Joint posterior predictive checkCan the fitted model reproduce selected features of biomarker and event histories?A discrepancy may be less localized or less specifically tied to a residual association term.

The methods are complementary. A local score provides a focused direction and time window; broader residual checks help identify competing explanations, while joint predictive checks assess whether the fitted model reproduces larger-scale features of both processes.

Common Mistakes and Limitations

  • Reading a positive score as only “more events after positive residuals.” Negative \(q_i(t)\) paired with fewer events than predicted also contributes positively. Inspect the product \(q_i(t)\{dN_i(t)-Y_i(t)\widehat h_i(t)dt\}\).
  • Calling the bracket the variance. The integrated squared score weight is a predictable quadratic variation. Its expectation is the martingale's unconditional variance under the stated conditions; the observed bracket is commonly used as an information or variance estimate, not an identity for that variance.
  • Using residuals that include future information. A residual summary at \(t\) based on biomarker observations after \(t\) is not a predictable history summary. Use past-only residuals for this construction, or treat the resulting analysis as a different, non-martingale diagnostic and calibrate it accordingly.
  • Treating an exploratory score as a p-value. A plug-in score and bracket do not automatically account for estimated parameters, latent effects, generated residuals, or searching across windows. Use an appropriate marginal score calculation or a null resampling procedure that refits the model and repeats the diagnostic.
  • Over-interpreting the result. A detected local alignment can arise from misspecified hazard structure, unmeasured time-varying predictors, residual-model problems, or chance. It does not establish that biomarker changes cause events.

This diagnostic is limited by its chosen history summary and time window: it can miss associations that operate through a different lag, a nonlinear transformation, or a longer-term biomarker history. It is also less informative when measurement schedules are sparse or the risk set is small. A weak score is not proof of adequate association specification.

Key takeaway: A time-local association score weights each event residual by a prespecified summary of recent biomarker residuals. Its value is diagnostic evidence about weighted alignment in a window; credible inference requires predictable summaries, a suitable null calibration, and consideration of competing sources of model misfit.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. If \(q_i(t)<0\) and fewer events occur than the fitted hazard predicts, is the score contribution positive or negative?
  2. Why should \(q_i(t)\) use only biomarker information available before \(t\) for the martingale-score derivation?
  3. A window score is positive. Name two distinct patterns that could contribute positively to it.
  4. In one sentence, distinguish predictable quadratic variation from the unconditional variance of the score.
  5. Why does trying many time windows and reporting only the strongest score require special calibration?

Solutions. (1) Positive: both \(q_i(t)\) and the event residual are negative, so their product is positive. (2) The score derivation requires the weight at time \(t\) to be predictable; using future observations makes it depend on information not yet available at that time. (3) Positive \(q_i(t)\) with an event excess, or negative \(q_i(t)\) with an event deficit. (4) The bracket is the realized predictable quadratic variation, while the unconditional variance equals its expectation under the stated martingale conditions. (5) Selecting the largest score across many windows increases the chance of an extreme result under the null, so the calibration must reproduce the entire search.

Clinical Biostats