Tutorials › Competing Risks and Multi-State Models › Organizing Repeated Landmark Data for Direct Prediction

Landmarking and Dynamic Prediction · Tutorial 501 of 699

Organizing Repeated Landmark Data for Direct Prediction

Learn to construct one clearly defined subject-landmark record per eligible prediction occasion, with its available history and correctly ascertained future state.

Advanced 10 min read

What You'll Learn

  • Define the subject-landmark row and its prediction target.
  • Build repeated landmark records from longitudinal state histories.
  • Separate available landmark information from future outcome information.
  • Identify when a future state is unobserved because of censoring.
  • Recognize how repeated rows affect weighting, dependence, and data splitting.
  • Audit a reshaped data set for timing errors and unsupported predictions.

From Longitudinal Histories to Prediction Rows

A longitudinal multi-state record follows a person over time, while a direct landmark prediction asks a specific question: given the person’s observed history at a chosen time, what state will the person occupy after a specified horizon? Organizing the data means making that question explicit in every row. A row is not merely a person or a visit; it represents a person at a landmark and the future prediction occasion attached to that landmark.

This construction uses the landmark idea that predictions are conditional on information available at a landmark. The earlier material on landmarking and dynamic prediction establishes the prediction target. Here the focus is the data structure needed to represent it without mixing information from different times or treating an unknown future state as an observed outcome.

Definition: Let \(X_i(t)\) denote the state of individual \(i\) at time \(t\), and let \(\mathcal S\) be the set of states. For a landmark time \(s\) and prediction horizon \(h>0\), an eligible subject-landmark record has predictors \(Z_i(s)\) made available by time \(s\), and a target \(Y_i(s,h)=X_i(s+h)\) when the state at \(s+h\) is ascertained. Eligibility requires the individual to be in the prediction target population at \(s\), according to the stated design.

For example, if the states are healthy, ill, and dead, a record at landmark \(s\) can use the current state, earlier history, and covariates observed by \(s\) to target the state at \(s+h\). The future target is one state in \(\mathcal S\); it is not the transition path between \(s\) and \(s+h\). If the scientific question is instead about a path or a particular transition, a different outcome structure is needed.

A repeated-landmark data set therefore has a subject identifier and a landmark identifier or time, predictors evaluated at that landmark, and a future outcome for the specified horizon when observed. The pair \((i,s)\) should uniquely identify a row for a fixed horizon. If several horizons are analyzed, include the horizon in the key as well. A single person can contribute several rows, but each row must refer to its own landmark-specific history and target.

Constructing the Rows

Start with longitudinal records that establish state and covariate histories over time. Choose the landmark schedule and horizon before generating outcomes. Then, for each person and landmark, determine whether the person belongs to the target population at that time; retain only information available by the landmark; and determine whether the state at the target time is observed. A state observed after the landmark must never be carried backward into the predictors.

The following hypothetical histories use equally spaced times \(0,3,6,9\), with states healthy (H), ill (I), and dead (D). The fixed horizon is \(h=3\). For illustration, landmarks are at \(0,3,6\), and a person who has died is no longer eligible for a later landmark.

Worked Example: Expanding Three Histories Into Landmark Rows

Suppose the observed histories are: A is H at time 0, I at 3 and 6, and D at 9; B is H at 0 and 3, then I at 6 and 9; C is I at 0 and 3, then D at 6. Assume these states are observed at all listed times. Form the subject-landmark records for horizon 3.

For each eligible landmark \(s\), the target is the recorded state at \(s+3\). A remains eligible at landmarks 0, 3, and 6; B does too. C is eligible at 0 and 3, but not at 6 because C is already dead then. The resulting records are:

SubjectLandmark \(s\)State at \(s\)Target time \(s+3\)Target state
A0H3I
A3I6I
A6I9D
B0H3H
B3H6I
B6I9I
C0I3I
C3I6D

There are eight records: three for A, three for B, and two for C. For A at landmark 3, for instance, the predictor state is I and the outcome is I at time 6; the state D at time 9 is not available for that row’s predictors. The table distinguishes the state at the landmark from the state at the target time, which is essential even when both happen to be the same.

Precisely Defining Predictors and Outcomes

The landmark predictor vector \(Z_i(s)\) may contain baseline covariates, the state at \(s\), and summaries of history observed up to \(s\), such as time already spent in a state. Its content depends on the intended prediction rule, but the timing rule does not: every component must be known at or before \(s\). If a covariate is only recorded at visits, use the value or history genuinely available under the planned prediction procedure; do not silently substitute a later measurement.

A direct state-occupation outcome is categorical. For a known target state, it can be represented with indicators \(I\{Y_i(s,h)=k\}\), one for each state \(k\in\mathcal S\). Exactly one indicator equals one and the rest equal zero. This representation is a property of an observed, known outcome; it does not mean that an outcome is known merely because a row has been created.

The outcome definition also fixes the target population. For example, if predictions are intended for people alive and under observation at landmark \(s\), the eligibility rule must say so. If death is one of the possible states at the horizon, a person who is alive at \(s\) and dies before \(s+h\) has a valid future state of D, provided that death is ascertained. Excluding such a person because death occurred before the target time would change the prediction target.

Worked Example: Recording an Unobserved Future State

Suppose five hypothetical individuals are eligible at landmark 3, and the target is their state at time 6. Two are observed in H at 6, one is observed in I, one is known to have died before 6, and one has follow-up ending at time 5 while alive in H. Determine the outcome status of each record.

The first four records have known target states: H, H, I, and D. Their state-indicator vectors for ordered states \((H,I,D)\) are respectively \((1,0,0)\), \((1,0,0)\), \((0,1,0)\), and \((0,0,1)\). For the fifth individual, the state at time 6 is not observed: being alive in H at time 5 does not establish the state at time 6. That record has a missing or unascertained target, not an H outcome.

Thus four of the five eligible records have observed target states. The fifth must not be assigned to a state simply to make the outcome complete. Any method that uses partially observed outcomes requires its own assumptions and procedures; the data layout alone does not resolve that missing-outcome problem.

Why the Reshaping Rules Matter

The basic logic can be stated directly. For a fixed eligible pair \((i,s)\), the desired prediction is conditional on the information \(Z_i(s)\) available at that time, and the target is the state at \(s+h\). If instead a predictor uses information observed after \(s\), it describes a different conditioning set. If instead the outcome is recorded at a different time, it describes a different target. Therefore a row is valid for the intended prediction only when both its information cutoff and target time match its declared landmark and horizon.

$$ \text{record }(i,s,h):\qquad \bigl(\text{identifier}=i,\ \text{landmark}=s,\ Z_i(s),\ \text{target time}=s+h,\ Y_i(s,h)\bigr). $$

When \(Y_i(s,h)\) is known, the one-hot indicators obey

$$ \sum_{k\in\mathcal S} I\{Y_i(s,h)=k\}=1. $$

This identity follows because the observed target belongs to exactly one state in the defined state set. It provides a simple structural check: a known categorical outcome should map to precisely one target category. It does not apply to a target that is unobserved; coding an unobserved value as all zeros would incorrectly conflate missingness with a known outcome.

1
Declare the prediction occasion.
Specify the landmark schedule, horizon, target population at each landmark, and state set. These choices determine what each row means.
2
Apply eligibility at the landmark.
Use only the stated criteria at time \(s\), including any restriction on current state or survival to the landmark.
3
Build the landmark history.
Populate predictors only with values and summaries available by \(s\). Keep the subject identifier and landmark time attached to the row.
4
Assign the future target status.
Look for the state at \(s+h\). Record the state if ascertained; otherwise record the target as unobserved and retain its reason where available.

Repeated Rows, Dependence, and Data Splitting

The rows are prediction occasions, not necessarily independent people. A subject can contribute several rows, and adjacent prediction windows can overlap. For example, the outcome at time 6 for a landmark at 3 may also be part of the history used for a landmark at 6. This is not automatically an error: the later row is a new prediction occasion with a later information cutoff. It does mean that any later statistical analysis must account for the actual repeated-subject structure where required.

The row count also encodes a weighting choice. If each eligible subject-landmark pair contributes equally to a model’s fitting criterion, a person contributing five landmarks has five times as many rows as a person contributing one. That can be appropriate when the target is performance over prediction occasions. If the intended target gives equal weight to people, the analysis may need a different weighting or sampling design. The reshaping step should preserve the rows faithfully and make this choice visible rather than implicitly treating the row count as the number of distinct people.

For data splitting or resampling intended to assess predictions on new people, assign all records from a given individual to the same partition. Splitting rows at random can place one person’s early landmark in training and later landmark in testing. The resulting assessment may then benefit from person-specific information shared across the split and no longer represent performance on new individuals.

Worked Example: Detecting Subject Leakage in a Split

Suppose a reshaped data set has 12 rows from four people: A contributes four rows, B three, C three, and D two. A proposed random row split puts eight rows in training and four in testing. Person A has three training rows and one testing row; person B has two training rows and one testing row; C and D appear only in training.

This split contains subject leakage for A and B because their records occur on both sides. It also tests only two of the four people. If the goal is assessment on new individuals, first split the four subject identifiers, then place every row from each selected individual into the corresponding partition. For example, assigning A and C to training gives \(4+3=7\) training rows, while assigning B and D to testing gives \(3+2=5\) testing rows. The row totals need not match the planned eight and four; keeping subjects intact takes priority for this target.

Diagnostics, Alternatives, and Limitations

Several checks catch common construction failures before any prediction model is fitted:

  • Check that the key made from subject, landmark, and (if applicable) horizon has no unintended duplicates.
  • Confirm that each target time equals the landmark plus the declared horizon and that target states belong to the defined state set.
  • Verify that no predictor uses a measurement recorded after its row’s landmark.
  • Check that records after an absorbing terminal state, such as death, are excluded when the target population requires the person to be alive at the landmark.
  • Tabulate known and unobserved outcomes by landmark, target state, and reason for unobserved status; inspect whether any landmark has little or no support.
  • For known outcomes, verify that exactly one state indicator is one. Keep unknown outcomes distinct from every state.

A common mistake is to treat every eligible landmark row as a complete case and assign the last observed state to the future target. The reasoning is that the last state is the best available information. The correction is that a state at time \(u<s+h\) is not, by itself, the state at \(s+h\): a transition may occur in between. The target must be ascertained at the specified time, or its missingness must be handled using an appropriate method with explicit assumptions.

An alternative is to organize data in a wide format, with one row per person and separate columns for each landmark’s predictors and outcome. That can be convenient for a small, fixed set of landmarks, but it makes the landmark-specific information cutoff and outcome pairing harder to audit and is less flexible when individuals have different numbers of eligible landmarks. A long format makes the prediction occasion explicit. Transition-specific models are another way to obtain state-occupation predictions, but they organize information around transitions and their model components; the present structure is for direct landmark-to-future-state records, not a tutorial on fitting either approach.

Reshaping cannot fix insufficient observation or define the scientific target on its own. The state process, landmark eligibility, horizon, and handling of incomplete follow-up must be defensible for the intended use. A correctly keyed table can still have biased or unsupported outcomes if follow-up patterns, state ascertainment, or the target population are misunderstood.

Key takeaway: One row represents one individual at one eligible landmark for one declared horizon. Its predictors must be available by the landmark, and its target must be the state at the specified future time—or explicitly marked as unobserved.

Check Your Understanding

Answer each question using the stated landmark and horizon. Solutions are provided below the questions.

  1. A person is in state A at landmark 4, and the horizon is 2. What is the target time, and which state should be used as the outcome?
  2. A person is observed in state B at time 5, but follow-up ends at time 6. The landmark is 5 and the horizon is 3. Is the outcome at the target time known from these data?
  3. For a known outcome with three possible states, how many one-hot indicators should equal one?
  4. Why should records from the same individual stay together when splitting data to assess prediction for new individuals?

Solutions. (1) The target time is \(4+2=6\); use the observed state at time 6, not the state at landmark 4. (2) The target time is \(5+3=8\), so the outcome is not established by follow-up ending at 6; state B at time 5 cannot be carried forward as the outcome. (3) Exactly one indicator equals one, because the known target occupies exactly one of the three states. (4) Keeping all of a person’s records together prevents information from that person’s training rows from leaking into the test set, which would undermine assessment on new people.

Clinical Biostats