Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Building a Landmark Dataset from Longitudinal Records

Landmarking as an Alternative · Tutorial 625 of 697

Building a Landmark Dataset from Longitudinal Records

Learn to create one well-defined record for each eligible patient at each landmark, keeping predictor history and subsequent outcome information separate.

Intermediate 10 min read

What You'll Learn

  • Define eligibility using event-free follow-up through the landmark.
  • Organize one patient-landmark row for each eligible pair.
  • Restrict predictor information to measurements available by that landmark.
  • Calculate post-landmark follow-up time and event indicators.
  • Identify when a censored patient’s fixed-horizon outcome is unknown.
  • Check for data leakage, duplicate records, and inconsistent time origins.

From Visit Records to Landmark Records

Longitudinal records are often stored with one row per visit, while event records usually have one row per patient. Landmark analysis needs a different unit of analysis: a patient considered at a particular landmark time. Reshaping the records requires more than joining tables. Each resulting row must identify whether the patient is eligible at that time, which measurement history was available then, and what happened afterward.

The key boundary is the landmark. Information recorded after it cannot be used as a predictor for that landmark, and follow-up for its outcome begins at that landmark. Applying both rules consistently avoids using future information to predict an earlier risk.

Definition: Let \(i\) index patients and let \(s_\ell\) denote landmark time \(\ell\). Write \(t_{ij}\) for the time of visit \(j\) for patient \(i\), and \(y_{ij}\) for a measurement recorded at that visit. Let \(T_i\) be the time of the event of interest and \(C_i\) the censoring time. The observed follow-up time is \(\tilde T_i=\min(T_i,C_i)\), with event indicator \(\Delta_i=I(T_i\le C_i)\). Patient \(i\) is eligible at \(s_\ell\) if event-free follow-up is established through that time; under this notation, this requires \(\tilde T_i>s_\ell\). A landmark dataset has one row for each eligible patient-landmark pair.

The strict inequality adopts the convention that an event at the landmark makes a patient ineligible at that landmark. If event and landmark timestamps can coincide, the analysis protocol must state their ordering; the data-processing rule must implement that convention consistently. A patient censored on or before the landmark is also ineligible because event-free status through the landmark cannot be established from the observed record.

A row should keep three kinds of information distinct: eligibility at the landmark, predictor history available by the landmark, and outcome follow-up after the landmark. The predictor history can include the visit times and measurements available up to \(s_\ell\), or a precomputed representation of that history. The choice of representation is a separate modeling decision. Whatever is stored, it must be based only on information available by the landmark.

Constructing a Patient-Landmark Row

Begin with a prespecified list of landmark times and a consistent time origin. For each patient and landmark, determine eligibility from event and censoring records. For eligible pairs, select only visits at or before the landmark, then attach the subsequent event and censoring follow-up using elapsed time from the landmark. Retaining explicit eligibility and follow-up fields makes the construction auditable.

1
Generate candidate pairs.
Create a candidate record for every patient and landmark being considered. Do not yet treat every candidate as an analysis row.
2
Determine eligibility.
Keep a pair as eligible only when event-free status through the landmark is established. Record the reason when a candidate is ineligible, such as an event or censoring on or before that time.
3
Attach predictor history.
For an eligible pair, include only visit information with \(t_{ij}\le s_\ell\), subject to the protocol’s rule for information recorded exactly at the landmark.
4
Reset the outcome time origin.
Calculate follow-up after the landmark, ending at the event or censoring time, whichever occurs first. Store the event indicator alongside that elapsed time.
5
Check the result.
Verify that each eligible patient-landmark pair appears once, that no predictor uses post-landmark information, and that all outcome times are nonnegative.

Worked Example: Building Rows at One Landmark

Consider four hypothetical patients and a landmark at \(s=6\) months. All times use months from enrollment. Patient A has visits at months 0, 4, and 6, an event at month 10, and is otherwise observed through month 12. Patient B has visits at months 0, 5, and 8 and an event at month 5.5. Patient C has visits at months 0 and 7, no event through month 9, and is censored at month 9. Patient D is censored at month 5 without an event. Which candidate pairs contribute analysis rows, and what history can be attached?

For A, \(\tilde T_A=10>6\), so A is eligible. The visits at months 0, 4, and 6 can be included if measurements at the landmark are available for use at that time. The month-10 event is outcome follow-up, not predictor history.

For B, \(\tilde T_B=5.5\le6\), and the event occurred before the landmark. B is ineligible. The visit at month 8 would not be a predictor at month 6 in any case.

For C, \(\tilde T_C=9>6\), so C is eligible. The month-7 visit is after the landmark and must be excluded from the predictor history. The month-0 visit is available; a missing or empty record of later pre-landmark visits does not itself make C ineligible.

For D, \(\tilde T_D=5\le6\) because censoring occurred before the landmark. Event-free status at month 6 is not established, so D is ineligible. The landmark dataset therefore has rows for A and C, with histories restricted to visits through month 6.

Define Post-Landmark Follow-Up Carefully

For an eligible pair, let the post-landmark observed follow-up time be \(R_{i\ell}=\tilde T_i-s_\ell\), and let the event indicator be \(\Delta_{i\ell}=\Delta_i\). Since eligibility requires \(\tilde T_i>s_\ell\), \(R_{i\ell}\) is positive. These fields describe residual follow-up from the landmark, rather than time from enrollment.

$$ R_{i\ell}=\min(T_i-s_\ell,\ C_i-s_\ell),\qquad \Delta_{i\ell}=I(T_i\le C_i) $$

These definitions assume a single time scale for events and censoring, a consistently defined event of interest, and correctly linked patient records. The construction itself does not make censoring non-informative. For example, interpreting survival estimates from the rows generally requires appropriate assumptions about censoring; the data reshaping cannot make those assumptions true. If a different event type or a competing event is relevant, its outcome coding must be specified rather than silently treating it as ordinary censoring.

For a fixed horizon \(h>0\), the event indicator by that horizon is known if an event occurs within \(h\), or if the patient is observed event-free for at least \(h\). Censoring before \(h\), without an earlier event, leaves the binary horizon outcome unknown. This distinction matters because labeling every such patient “no event” would incorrectly treat incomplete follow-up as evidence of remaining event-free.

Worked Example: Assigning a Fixed-Horizon Outcome

At the hypothetical landmark \(s=6\) months, consider a horizon \(h=4\) months. Patient P has an event at month 8; patient Q has an event at month 11; patient R is censored at month 9 without an event; and patient S has an event at month 6. Assume these times are measured from enrollment and event records are complete through the stated event times.

P is eligible because \(8>6\). The residual event time is \(8-6=2\) months, which is within the four-month horizon. P’s horizon outcome is event: the event indicator by \(h\) is 1.

Q is eligible, and the event occurs \(11-6=5\) months after the landmark. Q is observed beyond the four-month horizon without an event in that interval, so the horizon outcome is 0.

R is eligible because censoring at month 9 is after the landmark. But follow-up after the landmark is only \(9-6=3\) months. With no event by then, R’s four-month outcome is unknown, not 0.

S is ineligible at month 6 under the stated convention because the event time equals the landmark. S contributes no row to the eligible landmark analysis.

Why the Row Definition Matches the Landmark Question

At a landmark, the target population consists of patients who have remained event-free through that time. If \(T\) denotes event time and \(S(t)=P(T>t)\), the conditional probability of an event by \(s+h\), given survival beyond \(s\), is

$$ P(T\le s+h\mid T>s) = \frac{P(s<T\le s+h)}{P(T>s)} = \frac{S(s)-S(s+h)}{S(s)} =1-\frac{S(s+h)}{S(s)}. $$

The first equality in the calculation uses the event “event-free at \(s\) and event by \(s+h\),” which is \(s<T\le s+h\). Thus the row must represent a patient known to be event-free at \(s\), and its outcome follow-up must begin at \(s\). Including a patient who had the event before the landmark, or treating time since enrollment as if it were residual time, would not represent this conditional risk.

This argument clarifies the data structure, not the assumptions needed to estimate the risk. In particular, observed follow-up may end through censoring, and the handling of censoring must be appropriate for the analysis. The landmark row records what was observed; it does not resolve incomplete follow-up by itself.

Multiple Landmarks and Alternative Data Structures

Worked Example: A Patient at Two Candidate Landmarks

Suppose hypothetical patient E has visits at months 1, 4, and 7 and an event at month 5.5. Candidate landmarks are months 3 and 6. At month 3, E is event-free under observation, so the patient is eligible. The predictor history for that row can use the month-1 visit, but not the month-4 visit. The event occurs \(5.5-3=2.5\) months after the landmark and belongs to that row’s outcome follow-up.

At month 6, E is ineligible because the event occurred before the landmark. There is no month-6 analysis row for E. The month-7 visit cannot change that eligibility decision or serve as a predictor at either landmark. This example shows why eligibility and history must be assessed separately for each candidate time.

A landmark dataset differs from a one-row-per-patient dataset because a patient may be considered at more than one landmark. It also differs from the original visit-level file: visit rows record measurements over time, whereas a landmark row represents the patient’s status and available history at a specified prediction time. A joint longitudinal-survival analysis uses the longitudinal and event records in a different modeling structure; converting to landmark rows does not preserve every feature of that model.

If the same patient contributes eligible rows at several landmarks, those rows are not independent observations. The data may be arranged as one row per eligible patient-landmark pair, but later analyses must account for the actual sampling and dependence structure as appropriate. Conversely, collapsing multiple landmarks to a single patient row changes the set of prediction times and should not be done merely to make the table simpler.

Diagnostics, Common Errors, and Limits

After construction, check the dataset against its source records. Useful checks include confirming that no row has an event or censoring time at or before its landmark, that predictor visits do not occur after the landmark, and that residual follow-up equals the observed end time minus the landmark. Also verify that the event indicator agrees with the source event record and that each eligible patient-landmark pair appears exactly once.

A particularly common mistake is to label a patient with no recorded event by the horizon as a non-event, even when censoring occurred before the horizon. That reasoning confuses “no event observed” with “observed event-free through the horizon.” The correction is to mark the horizon status unknown when follow-up ends too early, unless a suitable analysis explicitly handles the censoring.

  • Future-information leakage: A visit after the landmark is included because it appears in the same patient file. Exclude it; availability in the source data does not make it available at prediction time.
  • Wrong time origin: Follow-up is stored from enrollment, then interpreted as time after the landmark. Subtract the landmark time for each eligible row.
  • Unverified eligibility: A patient censored before the landmark is treated as event-free at the landmark. Exclude that candidate pair because status through the landmark is not known.
  • Duplicate rows: A many-to-many join between visit and event files replicates patient-landmark records. Check pair uniqueness after joining and retain the visit history separately or summarize it according to the analysis plan.

The resulting records are only as reliable as their source times, event definitions, and censoring information. They do not, on their own, decide how to represent a patient’s biomarker history, how to handle missing measurements, or how to fit a prediction model. Those are distinct choices, and a well-constructed dataset makes them explicit rather than hiding them in a join or a recoding step.

Check Your Understanding

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

  1. At landmark month 12, a patient’s event occurs at month 12. Is the patient eligible under the convention used here?
  2. A patient is censored at month 10 and has no event recorded. Can the patient be assumed eligible at landmark month 12?
  3. At landmark month 5, a patient has an event at month 9 and censoring would otherwise occur at month 11. What are the post-landmark follow-up time and event indicator?
  4. A patient is event-free through month 14 but censored then. At landmark month 10 with horizon 6 months, is the horizon outcome known?

Solutions. (1) No. The event time equals the landmark, and eligibility requires \(\tilde T_i>s_\ell\). (2) No. Censoring before month 12 means event-free status through month 12 is not established. (3) Follow-up is \(9-5=4\) months and the event indicator is 1, since the event occurs before censoring. (4) No. The patient is followed only \(14-10=4\) months after the landmark, less than the six-month horizon, with no event; the horizon outcome is unknown.

Clinical Biostats