Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Worked Example: From Visits to Landmark Predictions

Landmarking as an Alternative · Tutorial 651 of 697

Worked Example: From Visits to Landmark Predictions

Learn how to organize visit data at a landmark, fit a simple fixed-horizon risk model, and interpret its predictions for individual survivors.

Intermediate 10 min read

What You'll Learn

  • Define the landmark cohort and the fixed-horizon event outcome.
  • Reduce repeated biomarker visits to a prespecified observed summary for each eligible person.
  • Fit and interpret a logistic model for event risk by the prediction horizon.
  • Calculate individual predictions from fitted coefficients and observed biomarker categories.
  • Recognize how incomplete follow-up, conditioning, and small samples limit interpretation.

From Visit Records to a Landmark Prediction

A longitudinal file may contain several biomarker measurements for each person, while a fixed-horizon prediction model needs one predictor record per person at the time a prediction is made. Landmarking provides that time point: restrict attention to people who are alive and event-free at the landmark, summarize information observed by then, and predict whether an event occurs during a prespecified period afterward.

The key is to keep the time ordering explicit. Measurements after the landmark cannot be used to predict an outcome that begins at the landmark. Likewise, people who have already had the event by the landmark are not members of the prediction cohort. The risk being estimated is therefore a conditional risk among landmark survivors, not a risk from the start of follow-up.

Definition: Let \(L\) be a landmark time and \(h\) a fixed prediction horizon. The landmark cohort consists of individuals who are alive and event-free at \(L\). For each eligible individual, define the binary outcome \(Y=1\) if the event occurs in \((L,L+h]\), and \(Y=0\) if the individual remains event-free through \(L+h\). A landmark record contains one row per eligible individual, with predictors calculated only from information available by \(L\).

For a simple fixed-horizon model, let \(X\) be a summary of a biomarker observed by \(L\). A logistic regression specifies the conditional event probability as

$$ P(Y=1\mid X,\text{event-free at }L) =\frac{\exp(\beta_0+\beta_1X)}{1+\exp(\beta_0+\beta_1X)}. $$

This model assumes independent individuals, correct ascertainment of the event status through the horizon, and an appropriate logit relationship between the predictor and event risk. If \(X\) is categorical, the model estimates a log odds for each category relative to a reference category. Predictions apply to the landmark survivor population represented by the data and model; they do not automatically describe people who did not survive event-free to \(L\).

Worked Dataset and Landmark Records

Consider a hypothetical study with a landmark at month 6 and a prediction horizon of 6 months, ending at month 12. All 12 individuals in the table are alive and event-free at month 6. Each has biomarker measurements at months 2, 4, and 6. The prespecified predictor is the last observed biomarker value at or before month 6, in mg/L. For this example, define the high category as a last value of at least 10 mg/L; lower values are classified as low. The outcome records whether an event occurs during the next 6 months.

PersonBiomarker at months 2, 4, 6 (mg/L)Last value at landmark (mg/L)CategoryEvent by month 12?
A6.8, 7.1, 7.47.4LowYes
B7.0, 7.6, 8.28.2LowNo
C6.5, 8.3, 8.88.8LowYes
D7.1, 7.5, 8.58.5LowNo
E8.0, 8.6, 9.09.0LowNo
F7.6, 8.8, 9.69.6LowNo
G8.0, 9.5, 10.210.2HighYes
H8.5, 10.4, 11.011.0HighYes
I9.0, 10.0, 11.811.8HighNo
J9.5, 11.5, 12.412.4HighYes
K8.8, 10.2, 13.113.1HighYes
L9.4, 11.2, 14.014.0HighNo

Worked Example: Creating the Landmark Cohort

To construct a record for person C, first check eligibility at month 6. Person C is alive and event-free at that time, so C belongs in the landmark cohort. The observed measurements by month 6 are 6.5, 8.3, and 8.8 mg/L. The last observed value is 8.8 mg/L, which is below the prespecified 10 mg/L cut point, so C's predictor category is low. C has an event within the following 6 months, so \(Y=1\).

C's resulting landmark record is therefore one row with person identifier C, category low, and outcome 1. The measurements are not three independent rows for the prediction analysis: they are the repeated observations used to calculate this person's landmark predictor. Applying the same rule to all 12 people produces 12 records.

The table also makes the time ordering checkable: every predictor is measured no later than month 6, and each outcome refers only to the interval after month 6 through month 12.

Fitting the Fixed-Horizon Model

Let \(X=0\) indicate a low last-observed biomarker and \(X=1\) indicate a high value. Fit the logistic model

$$ \operatorname{logit}\{P(Y=1\mid X,\text{event-free at }6)\} =\beta_0+\beta_1X, \qquad \operatorname{logit}(p)=\log\left(\frac{p}{1-p}\right). $$

In this small example, the model has a separate fitted risk for each of the two categories. There are 2 events among 6 people in the low category and 4 among 6 in the high category. These proportions determine the maximum-likelihood fitted probabilities. The resulting coefficients and risks can be derived directly.

Worked Example: Estimating the Category Risks

For the low category, the observed event proportion is \(2/6=1/3\). Its fitted log odds are

$$ \hat{\beta}_0 =\log\left(\frac{1/3}{1-1/3}\right) =\log(1/2) =-\log 2 \approx -0.693147. $$

For the high category, the observed event proportion is \(4/6=2/3\), so its fitted log odds are

$$ \hat{\beta}_0+\hat{\beta}_1 =\log\left(\frac{2/3}{1-2/3}\right) =\log 2 \approx 0.693147. $$

Subtracting the low-category log odds gives

$$ \hat{\beta}_1 =\log 2-(-\log 2) =\log 4 \approx 1.386294. $$

Thus the fitted event risks are \(1/3\), or about 0.333, for the low category and \(2/3\), or about 0.667, for the high category. With the exact coefficients, the high-category log odds equal \(-\log 2+\log 4=\log 2\), giving risk \(e^{\log 2}/(1+e^{\log 2})=2/3\). The estimated odds in the high group are four times those in the low group, since \(\exp(\hat{\beta}_1)=4\). This odds ratio is not a risk ratio.

The calculation is a special case of logistic maximum likelihood. For a category with \(y\) events among \(n\) people, its likelihood for event probability \(p\) is proportional to \(p^y(1-p)^{n-y}\). The log likelihood is \(y\log p+(n-y)\log(1-p)\). Differentiating with respect to \(p\) and setting the derivative to zero gives

$$ \frac{y}{p}-\frac{n-y}{1-p}=0 \quad\Longrightarrow\quad y(1-p)=p(n-y) \quad\Longrightarrow\quad \hat{p}=\frac{y}{n}. $$

So, when the model gives each category its own fitted probability, the maximum-likelihood prediction is the observed event proportion in that category. This justifies the direct calculation above; it does not mean that a small sample provides precise estimates.

Calculating Individual Predictions

Interpretation: A model-based fixed-horizon prediction is an estimated probability of the defined event during \((L,L+h]\), conditional on being event-free at \(L\) and on the predictors used in the model. It is not a probability that the model is correct, nor a causal effect of the biomarker.

Worked Example: Predicting Risk for Two Individuals

Person C's last value is 8.8 mg/L, so \(X=0\). Substituting into the fitted model gives log odds \(\hat{\beta}_0+\hat{\beta}_1X=-\log 2\). Converting to a probability,

$$ \hat{P}(Y_C=1) =\frac{\exp(-\log 2)}{1+\exp(-\log 2)} =\frac{1/2}{1+1/2} =\frac{1}{3} \approx 0.333. $$

The estimated probability for C is about 33.3% of an event by month 12, conditional on being event-free at month 6 and having a low last-observed value under this model.

Person K's last value is 13.1 mg/L, so \(X=1\). Using the exact fitted coefficients, the linear predictor is \(-\log 2+\log 4=\log 2\). Therefore,

$$ \hat{P}(Y_K=1) =\frac{\exp(\log 2)}{1+\exp(\log 2)} =\frac{2}{3} \approx 0.667. $$

K's estimated risk is about 66.7% by month 12, with the same conditioning on landmark survival. This is a group-based prediction: all people classified high receive the same estimate in this model. It does not imply that K's individual outcome is known or that the biomarker caused the difference in observed risks.

Assumptions, Checks, and Alternatives

Before using this procedure, verify that the analysis matches the intended prediction task. The landmark and horizon should be specified in advance, the eligible cohort should include only people event-free at the landmark, and the predictor calculation should use only information available by then. For the binary outcome, each person must have a known event status through \(L+h\). A person censored before \(L+h\) without an event cannot simply be coded as \(Y=0\), because that person's event status for the full horizon is unknown.

For a more general logistic model, check whether the chosen predictors and functional forms are plausible, whether categories have adequate data, and whether fitted risks are sensible. The present example has just 12 people and only two predictors levels; it is for learning the arithmetic, not for establishing reliable clinical predictions. Sparse categories can produce unstable estimates, and complete separation can make ordinary logistic maximum-likelihood estimates diverge. Out-of-sample calibration and discrimination are also relevant when judging a prediction model, but a numerical prediction alone does not establish that performance is adequate.

A fixed-horizon logistic model is direct and easy to interpret when the outcome is completely observed at a common horizon. A landmark Cox model instead uses event times and censoring after the landmark to model the event hazard; its conditional survival predictions can be converted to risks at a chosen horizon. The two approaches differ in their outcome model and data requirements. If follow-up is censored before the horizon, the simple binary-outcome calculation here is not justified without additional methods that address censoring.

The predictor also represents a deliberate summary of a trajectory. A last-observed value is not the same as a latent or error-free biomarker value, and it does not use the entire trajectory's shape. Visit timing may vary, and the last value can be less recent for some people than others. Those features can affect interpretation and predictive performance. The estimated risk is conditional on reaching the landmark and on the observed predictor information, so selection into the landmark cohort matters.

Common Pitfalls

  • Using post-landmark information. A measurement after month 6 cannot be used as a predictor for risk beginning at month 6. Restrict the summary to values observed by the landmark.
  • Treating an early censoring as no event. No recorded event before loss to follow-up does not establish that the person remained event-free through the horizon. Do not assign \(Y=0\) unless the outcome is known through \(L+h\).
  • Interpreting conditional risk as baseline-population risk. The prediction applies to people alive and event-free at \(L\), not automatically to everyone enrolled at the beginning.
  • Confusing odds and risk. A coefficient of \(\log 4\) means the estimated odds are multiplied by 4 for high versus low values in this model; it does not mean the risk is four times as large.
  • Reading a fitted risk as a personal certainty. A prediction of 0.667 is an estimated probability under the model, not a guarantee about the person's future event status.
Key takeaway: A landmark prediction requires one eligible person-level record, predictors based only on pre-landmark information, and an outcome defined over a clear post-landmark horizon. The resulting probability is conditional on landmark survival and the model's assumptions.

Check Your Understanding

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

  1. At landmark month 3, an individual is event-free and has biomarker values 4.0, 5.2, and 6.1 mg/L at months 1, 2, and 3. If the predictor is the last observed value, what value enters the landmark record?
  2. Among 10 landmark survivors in a category, 3 have the event by the horizon. What fitted category risk does a logistic model with a separate intercept for that category assign?
  3. In the worked model, what are the predicted risks for low and high categories, and what does the high-versus-low coefficient represent?
  4. A person is censored two months after the landmark, without a recorded event, when the prediction horizon is six months. Can this person be coded as event-free through the horizon? Why or why not?

Solutions. (1) Use 6.1 mg/L, the last measurement observed at or before month 3. The earlier measurements are not separate prediction records. (2) The fitted risk is \(3/10=0.300\), provided event status is known for all 10 people through the horizon. (3) The low and high fitted risks are \(1/3\approx0.333\) and \(2/3\approx0.667\). The coefficient \(\log 4\) represents a fourfold ratio of event odds for high versus low in this model, not a fourfold risk ratio. (4) No. The individual's event status for the remaining four months is unknown, so coding the outcome as zero would incorrectly treat incomplete follow-up as confirmed event-free survival.

Clinical Biostats