Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Nonlinear Biomarker Effects in Landmark Models

Landmarking as an Alternative · Tutorial 634 of 697

Nonlinear Biomarker Effects in Landmark Models

Represent nonlinear landmark biomarker effects with transformations or splines, then interpret and check predicted risks within the observed biomarker range.

Intermediate 12 min read

What You'll Learn

  • Define nonlinear biomarker effects in fixed-horizon logistic and landmark Cox models.
  • Construct a restricted cubic spline basis and use it to calculate fitted risks.
  • Interpret contrasts and changing slopes without treating spline coefficients as direct effects.
  • Compare splines with transformations and categorized biomarkers.
  • Identify risks of extrapolation, sparse data, censoring, and incorrect functional form.

Why Allow a Curved Biomarker Effect?

A landmark model predicts subsequent event risk among individuals who are event-free at a specified landmark time and have the information required to enter the landmark risk set. The biomarker recorded or summarized at that time need not have a straight-line association with subsequent risk. Risk might rise sharply at high values, flatten over part of its range, or be lowest near a middle value. A model that forces a straight-line effect can miss these patterns and produce misleading predictions.

The goal is to represent the association flexibly enough to capture meaningful curvature while retaining stable, interpretable predictions. This tutorial considers a fixed-horizon logistic model and a landmark Cox model. In both, the nonlinear term describes how the fitted risk changes across biomarker values; it does not by itself establish a causal effect.

Definition: Let \(t_L\) be a landmark time, \(X\) the biomarker value available at that time, and \(\Delta\) a prediction horizon. A nonlinear biomarker effect is a model in which the contribution of \(X\) to the linear predictor is a function \(f(X)\) that is not constrained to be a constant times \(X\). The function may be specified by a transformation, such as \(\log(X)\), or by a collection of basis functions, such as a spline.

Landmark Models with a Flexible Biomarker Term

For a fixed horizon, define \(Y=1\) if the event occurs after \(t_L\) and by \(t_L+\Delta\), and \(Y=0\) if it does not occur by that horizon. For individuals eligible at \(t_L\), a logistic model can be written as

$$ \operatorname{logit}\{P(Y=1\mid X,Z,T>t_L)\}=\beta_0+f(X)+\gamma^\mathsf{T}Z, $$

where \(Z\) denotes other predictors, \(T\) is the event time, and \(\operatorname{logit}(p)=\log\{p/(1-p)\}\). The predicted horizon risk for specified values \(x,z\) is

$$ \hat p(x,z)=\frac{\exp\{\hat\beta_0+\hat f(x)+\hat\gamma^\mathsf{T}z\}}{1+\exp\{\hat\beta_0+\hat f(x)+\hat\gamma^\mathsf{T}z\}}. $$

A landmark Cox model instead describes the hazard at residual time \(u\) after the landmark. One form is

$$ h(u\mid X,Z,T>t_L)=h_0(u)\exp\{f(X)+\gamma^\mathsf{T}Z\}. $$

Here \(h_0(u)\) is the baseline hazard. Under proportional hazards, the biomarker’s contribution is constant over residual time, though its association with the biomarker value can be nonlinear. A contrast between \(x_1\) and \(x_0\), holding \(Z\) fixed, has hazard ratio \(\exp\{f(x_1)-f(x_0)\}\). It is the contrast in fitted function values—not an individual spline coefficient—that determines this hazard ratio.

Assumptions to check: The model is fitted to the eligible landmark risk set, and each predictor used for prediction is available at the landmark. A fixed-horizon binary outcome must be ascertained correctly: a person censored before the horizon cannot simply be treated as event-free through that horizon. The Cox model requires appropriate handling of censoring and, for its usual interpretation, proportional hazards conditional on the modeled predictors. In either model, the chosen function must describe the biomarker-risk association adequately over the range where predictions will be used.

Representing Curvature

A transformation is a compact choice of shape. For example, \(f(X)=\beta_1\log(X)\) is appropriate only for positive \(X\), and specifies a particular relationship between the log biomarker and the model’s linear predictor. A quadratic term, \(f(X)=\beta_1X+\beta_2X^2\), permits curvature but may impose an unrealistic shape, especially near the ends of the observed range.

Splines use several basis functions to make a flexible curve. A restricted cubic spline is cubic between knots and constrained to be linear beyond its boundary knots. With three ordered knots \(\kappa_1<\kappa_2<\kappa_3\), a simple restricted cubic spline representation has a linear term and one nonlinear basis function:

$$ D(x)=\frac{(x-\kappa_1)_+^3-(x-\kappa_3)_+^3}{\kappa_3-\kappa_1} -\frac{(x-\kappa_2)_+^3-(x-\kappa_3)_+^3}{\kappa_3-\kappa_2}, \qquad f(x)=\beta_1(x-c)+\beta_2D(x), $$

where \(a_+=\max(a,0)\), and \(c\) is a centering value. With more knots, the basis contains additional nonlinear terms. The knot locations and number of knots determine how much flexibility is available; they should be chosen with the data range and sample size in mind, not by searching for a curve that happens to fit every fluctuation.

Worked Example: Calculating Risks from a Restricted Cubic Spline

Suppose a hypothetical fixed-horizon landmark logistic model uses a biomarker \(X\) measured in mg/L, with knots at 0, 10, and 20 mg/L and centering value \(c=10\). For a fixed covariate profile, the fitted linear predictor is \(\hat\eta(x)=-2+0.04(x-10)-0.006D(x)\), where \(D(x)\) is the basis above. Calculate predicted risks at 5, 10, and 15 mg/L.

At \(x=5\), both \((5-10)_+\) and \((5-20)_+\) are zero, while \((5-0)_+^3=125\). Thus \(D(5)=125/20=6.25\). The linear predictor and risk are

$$ \hat\eta(5)=-2+0.04(-5)-0.006(6.25)=-2.2375, \qquad \hat p(5)=\frac{e^{-2.2375}}{1+e^{-2.2375}}\approx 0.0964. $$

At \(x=10\), \(D(10)=1000/20=50\), so \(\hat\eta(10)=-2+0-0.006(50)=-2.300\), and \(\hat p(10)=e^{-2.300}/(1+e^{-2.300})\approx0.0911\).

At \(x=15\), the two nonzero truncated cubes are \(15^3=3375\) and \(5^3=125\). Therefore \(D(15)=3375/20-125/10=156.25\). Then \(\hat\eta(15)=-2+0.04(5)-0.006(156.25)=-2.7375\), giving \(\hat p(15)\approx0.0608\). These fitted risks describe the model’s estimated horizon risk for the specified covariate profile; they are not observed individual outcomes.

Interpreting the Fitted Curve

With a linear biomarker term, a one-unit increase has the same change in the log odds at every biomarker value. With a nonlinear function \(f(x)\), the local change depends on \(x\). In a differentiable model, the slope of the log odds is \(f'(x)\); the change in predicted probability also depends on the current probability, since the logistic curve is steepest near one half and flatter near zero and one. For a clinical interpretation, predictions at clinically meaningful values and contrasts across the observed range are usually clearer than interpreting individual basis coefficients.

For a Cox model, \(f(x_1)-f(x_0)\) compares log hazards at two biomarker values, conditional on the other modeled predictors. The associated hazard ratio compares instantaneous event rates among individuals still at risk at the same residual time. It is not a ratio of fixed-horizon risks. A fixed-horizon risk from a Cox model also uses the estimated baseline cumulative hazard; under the model, survival through residual time \(\Delta\) is \(S(\Delta\mid x,z)=\exp[-H_0(\Delta)\exp\{f(x)+\gamma^\mathsf{T}z\}]\).

Worked Example: Interpreting a Curved Logistic Association

In a hypothetical landmark analysis, let \(z=(x-10)/5\), where \(x\) is measured in mg/L. Suppose the fitted fixed-horizon model for a specified covariate profile is \(\hat\eta(x)=-2+0.35z+0.50z^2\). Calculate risks at 5, 10, and 15 mg/L and interpret the pattern.

At 5 mg/L, \(z=-1\), so \(\hat\eta=-2-0.35+0.50=-1.85\) and \(\hat p=e^{-1.85}/(1+e^{-1.85})\approx0.1359\). At 10 mg/L, \(z=0\), giving \(\hat\eta=-2\) and \(\hat p\approx0.1192\). At 15 mg/L, \(z=1\), giving \(\hat\eta=-2+0.35+0.50=-1.15\) and \(\hat p\approx0.2405\).

For this fitted model, predicted risk decreases from 5 to 10 mg/L and then increases by 15 mg/L. The curve’s turning point follows from differentiating the linear predictor with respect to \(z\): \(0.35+1.00z=0\), so \(z=-0.35\), corresponding to \(x=10+5(-0.35)=8.25\) mg/L. This is a feature of the fitted association, not proof that changing a person’s biomarker would change their risk.

Worked Example: A Cox-Model Contrast at Two Biomarker Values

Suppose a hypothetical landmark Cox model gives \(f(4)=0.20\) and \(f(8)=0.65\) for biomarker values in mg/L, with other predictors held fixed. The estimated hazard ratio for 8 versus 4 mg/L is

$$ \exp\{f(8)-f(4)\}=\exp(0.65-0.20)=\exp(0.45)\approx1.568. $$

Thus, under the proportional-hazards model, the estimated instantaneous hazard at 8 mg/L is about 1.57 times that at 4 mg/L among individuals still event-free at the same residual time and with the same other modeled predictors. For illustration, if the estimated baseline cumulative hazard at a chosen horizon is \(H_0(\Delta)=0.12\), the fitted risk at \(x=4\) is \(1-\exp\{-0.12e^{0.20}\}\approx0.136\), while at \(x=8\) it is \(1-\exp\{-0.12e^{0.65}\}\approx0.205\). These risks depend on the baseline hazard as well as on the hazard ratio.

Choosing a Representation and Checking Its Adequacy

A spline is often a useful default when a straight-line effect is doubtful but there is not a strong scientific reason to impose a particular transformation. A transformation can be more concise and may be easier to explain when its shape is substantively justified. Categories are easy to display but discard within-category information, make results depend on cutpoints, and create artificial jumps at category boundaries. Categorizing a continuous biomarker is therefore not a general remedy for nonlinearity.

A flexible curve is not automatically a better model. Check how many observations and events support different parts of the biomarker range, inspect fitted risks or hazards across that range, and look for unstable bends near sparse tails. Compare a linear specification with a prespecified transformation or spline using appropriate model comparisons, while recognizing that improved fit alone does not guarantee accurate prediction. If the curve changes markedly with small changes in knot placement, the data may not support that degree of flexibility.

Predictions outside the observed range are especially fragile. A restricted cubic spline is linear beyond its boundary knots by construction, but that mathematical constraint does not provide empirical evidence that the relationship continues linearly there. Report the range used to fit and interpret the curve. Also distinguish uncertainty in the estimated curve from variation in individual outcomes; a point prediction is not a guarantee for a particular patient.

Common pitfall: A reader sees a positive coefficient for one spline basis term and concludes that higher biomarker values always mean higher risk. This is incorrect because the full curve is a weighted sum of the linear and nonlinear basis terms. Evaluate \(f(x)\), or a contrast \(f(x_1)-f(x_0)\), at values of interest. Likewise, a low fitted risk at a sparsely observed extreme should not be presented as reliable evidence of low risk there.

Deriving a Risk Contrast from the Model

The interpretation of a nonlinear logistic model follows directly from its odds. Holding other predictors fixed, the fitted odds at biomarker value \(x\) are \(\exp\{\beta_0+f(x)+\gamma^\mathsf{T}z\}\). For values \(x_1\) and \(x_0\), dividing these odds cancels the intercept and the terms for \(z\):

$$ \frac{\operatorname{odds}(Y=1\mid x_1,z,T>t_L)} {\operatorname{odds}(Y=1\mid x_0,z,T>t_L)} = \frac{\exp\{\beta_0+f(x_1)+\gamma^\mathsf{T}z\}} {\exp\{\beta_0+f(x_0)+\gamma^\mathsf{T}z\}} = \exp\{f(x_1)-f(x_0)\}. $$

This derivation explains why a single spline coefficient is not generally an odds ratio for a one-unit biomarker increase. The contrast depends on both values being compared and on the entire fitted function. The same subtraction of function values yields a Cox log-hazard contrast, but the resulting hazard ratio is not an odds ratio or a fixed-horizon risk ratio.

Check Your Understanding

Work each problem before reading its solution.

  1. A fixed-horizon landmark model has \(\hat\eta(x)=-1.5+0.2x\), with \(x\) measured in mg/L. Calculate the predicted risk at \(x=5\).
    Solution: \(\hat\eta(5)=-1.5+0.2(5)=-0.5\). Thus \(\hat p=e^{-0.5}/(1+e^{-0.5})\approx0.3775\), or about 37.8% for the specified horizon and covariate profile.
  2. In a Cox model, \(f(6)=0.10\) and \(f(9)=0.40\). What is the estimated hazard ratio for 9 versus 6 mg/L, holding other predictors fixed?
    Solution: \(\exp\{0.40-0.10\}=\exp(0.30)\approx1.350\). The estimated hazard is about 1.35 times as high at 9 mg/L among individuals at risk at the same residual time, under proportional hazards.
  3. Why is a positive coefficient on one spline basis term not enough to conclude that risk increases throughout the biomarker range?
    Solution: The fitted function combines all basis terms and their coefficients. Its change between \(x_0\) and \(x_1\) is \(f(x_1)-f(x_0)\), which may be positive in one part of the range and negative in another.
  4. A person in a fixed-horizon landmark cohort is censored before the prediction horizon without an observed event. Why should that person not automatically be coded \(Y=0\)?
    Solution: Their event status through the full horizon is unknown. Coding them as event-free would treat unobserved follow-up as if it established survival without an event; the analysis must handle censoring appropriately.
Clinical Biostats