Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Landmark Validation with Subject-Level Data Splits

Landmarking as an Alternative · Tutorial 647 of 697

Landmark Validation with Subject-Level Data Splits

Build validation splits that keep every landmark record for a patient together, and understand what these splits do—and do not—guarantee about predictive performance.

Intermediate 12 min read

What You'll Learn

  • Explain why splitting landmark rows at random can leak patient-specific information.
  • Construct a train-validation split that assigns all records from each patient to one partition.
  • Extend subject-level allocation to grouped cross-validation.
  • Distinguish patient-level validation from temporal and external validation.
  • Identify preprocessing and feature-construction steps that can leak information across partitions.
  • Recognize how unequal numbers of landmark rows affect the target represented by a performance summary.

Why the Split Unit Matters

A landmark data set may contain several records for one patient: one record for each eligible landmark time. Each record uses information available by that landmark to predict a later event outcome. If records from the same patient are placed in both the training and validation sets, the validation set is no longer a clean assessment on patients unseen during model fitting. The model may benefit from patient-specific patterns already represented in training, and the resulting performance estimate can be optimistic for deployment to new patients.

The essential design rule is simple: assign patients to partitions first, then carry all of each patient’s landmark records into that partition. The number of rows is not the number of independent patients. Keeping this distinction explicit is especially important when patients contribute different numbers of eligible landmarks.

Definition: A subject-level split assigns each patient wholly to one data partition. For patient \(i\), let \(\mathcal{R}_i\) be the set of all eligible landmark records belonging to that patient. If patient \(i\) is allocated to training, every record in \(\mathcal{R}_i\) is used only for training; if allocated to validation, every record in \(\mathcal{R}_i\) is used only for validation. No patient identifier may occur in both partitions.

For example, write a record as \((i,k)\), where \(i\) identifies the patient and \(k\) identifies that patient’s landmark occasion. A record can contain predictors measured by landmark time \(s_k\) and an outcome defined over a later prediction horizon. The split is based on \(i\), not on \((i,k)\). The landmark time, event status, and number of rows do not change which patient owns a record.

What the Validation Design Targets

A subject-level split is appropriate when the intended use is prediction for patients who were not used to fit the model. It estimates performance on held-out patients sampled from a population resembling the development patients, subject to the split design and the chosen performance measure. It does not automatically estimate performance at a different hospital, in a later calendar period, or under a changed clinical process.

It is also important to define what a “typical prediction” means. If one patient contributes five landmark rows and another contributes one, a summary that gives equal weight to every row gives the first patient five times as much influence. A summary that first averages within each patient and then across patients targets a different weighting. Subject-level splitting prevents cross-partition leakage, but it does not decide this weighting question. Choose and report the target that matches the intended use.

The split must also respect how predictions will be made. If deployment concerns new patients, a row-wise split is not a substitute for a patient-wise split. If the aim is to predict future records for patients already observed, a chronological split may instead be relevant; that answers a different question and must ensure that later information cannot enter earlier predictions.

Worked Example: Assigning Landmark Records to Partitions

Suppose four hypothetical patients have the following eligible landmark records: patient A has records at 3 and 6 months; B has one at 3 months; C has records at 3, 6, and 9 months; and D has one at 6 months. We want a patient-level training-validation split.

First allocate patients, for example, A and C to training and B and D to validation. Then transfer all records belonging to each allocated patient:

$$ \text{Training}=\{(A,3),(A,6),(C,3),(C,6),(C,9)\}, \qquad \text{Validation}=\{(B,3),(D,6)\}. $$

The training set has five rows and the validation set has two, but the split has two training patients and two validation patients. Each patient identifier appears in exactly one partition. A row-wise 70%/30% split would not guarantee this property, regardless of how many rows it happened to place in each set.

This tiny example does not imply that a 50% patient split is generally preferable. The allocation fraction should reflect the amount of data available, the precision needed for validation, and whether a separate test set is required. The example demonstrates the grouping rule, not a universal proportion.

Why Row-Wise Splitting Leaks Patient Information

A random split of rows treats repeated records as if they were separate units for allocation. But records from one patient are typically related: they may share baseline characteristics, biomarker trajectories, measurement patterns, and event history. A model trained on one landmark row can therefore have an advantage when predicting a different row from the same person. This is a dependence and information-overlap problem, even when the outcome for the validation row was not directly used during fitting.

A simple calculation shows how readily this can happen. Suppose each row is independently assigned to training with probability \(q\), and a patient contributes \(m\) rows. The probability all of that patient’s rows land in training is \(q^m\); the probability all land in validation is \((1-q)^m\). Therefore, the probability the patient appears in both partitions is

$$ P(\text{patient appears in both}) =1-q^m-(1-q)^m. $$

The expression follows because the only ways a patient avoids being split across partitions are for all \(m\) rows to be in training or for all \(m\) rows to be in validation. Those two events are disjoint, so subtract their probabilities from one. Under subject-level allocation, by contrast, the probability of a patient appearing in both partitions is zero by design.

Worked Example: Probability of Leakage Under a Row Split

Suppose a row-wise split assigns each record to training with probability \(q=0.80\), and a hypothetical patient contributes three landmark rows. The probability that all three rows are in training is

$$ 0.80^3=0.512. $$

The probability that all three are in validation is

$$ 0.20^3=0.008. $$

Thus the probability that the patient has rows in both sets is

$$ 1-0.512-0.008=0.480. $$

So even with only three rows per patient, this design gives a 48.0% chance that a given patient appears in both partitions. If 40 patients each contributed three rows and allocation were independent across rows, the expected number split across partitions would be \(40(0.480)=19.2\). This is an expectation, not a guarantee that exactly 19 or 20 patients will be split. The calculation illustrates why row-level randomization is unsuitable for assessing prediction on new patients.

Practical Design for a Holdout Split

A defensible holdout workflow begins with the patient identifiers, not with a randomization of the landmark table’s rows. Create a unique list of patients, allocate those identifiers to training and validation, and join the allocation back to every landmark record. Check that the sets of patient identifiers are disjoint and that all eligible records for each assigned patient have been handled consistently.

1
Define the prediction cohort.
Specify which patients and landmark records are eligible, including the relevant landmark times and prediction horizons. Use only information available at each landmark to form predictors.
2
Allocate unique patients.
Randomly or deliberately assign patient identifiers to partitions. If allocation is stratified, use patient-level characteristics or summaries and preserve the grouping; never stratify by scattering a patient’s rows across sets.
3
Attach the allocation to records.
Every row for a patient inherits that patient’s single assignment. Verify that the training and validation identifier sets have an empty intersection.
4
Fit all learned processing in training data.
Estimate imputation rules, scaling constants, feature selection, and tuning choices using training data only. Apply the resulting operations to validation data without re-estimating them there.
5
Evaluate once under the prespecified plan.
Generate validation predictions using the fitted model and the prespecified outcome and scoring approach. Keep the validation set out of model selection if it is meant to provide a final holdout assessment.

These steps address distinct leakage routes. A perfect patient split can still be undermined if a biomarker summary uses measurements taken after the landmark, if validation data help select predictors, or if imputation and scaling are estimated using both partitions. Conversely, fitting preprocessing within training folds does not repair a split that has already placed the same patients on both sides.

Worked Example: Constructing Grouped Cross-Validation Folds

Consider 12 hypothetical patients, six with an observed event during the specified outcome window and six without one. Each patient may contribute a different number of landmark rows. For three-fold cross-validation, we can allocate four patients to each validation fold, aiming for two event patients per fold when feasible. One possible patient allocation is:

$$ \begin{aligned} \text{Fold 1 validation:}&\ \{1_E,2_E,7_N,8_N\},\\ \text{Fold 2 validation:}&\ \{3_E,4_E,9_N,10_N\},\\ \text{Fold 3 validation:}&\ \{5_E,6_E,11_N,12_N\}. \end{aligned} $$

Here \(E\) and \(N\) label the illustrative event and non-event patients, not individual landmark rows. In fold 1, for example, every row from patients 1, 2, 7, and 8 is held out; the model is fitted using every eligible row from the other eight patients. Repeat this process for the other folds. Each patient receives predictions only from a model that did not use any of that patient’s records for fitting.

The event balance shown is a planning aid, not a requirement that overrides grouping. If event counts are too small, exact balance may be impossible. The split should preserve patient integrity and be transparent about any imbalance. With very few patients, cross-validation estimates may be highly variable; increasing the number of folds does not create more independent patients.

Diagnostics, Alternatives, and Limitations

After creating a split, audit it rather than relying on the code’s intended behavior. Confirm that no identifier occurs in both partitions; count unique patients separately from rows; inspect the number of landmark records per patient in each partition; and compare the distribution of landmark times and key patient-level characteristics. If relevant outcomes are sparse, inspect their patient-level counts as well. Large imbalances can make an estimate unstable, though balancing cannot guarantee representativeness.

Common alternatives serve different purposes. A random row split is easy but invalid for new-patient validation when patients repeat. Grouped cross-validation reuses patients across training and validation roles across folds while ensuring that, within each fold, a patient is held out as a whole. A temporal split evaluates a later period and can reflect changes over time, but requires a clear time ordering and protection against future information. External validation uses a distinct data source or setting and addresses transport to that setting; a random subject split from one cohort does not provide this evidence.

A holdout split sacrifices some data for model fitting, while repeated grouped cross-validation uses data more efficiently but can have substantial uncertainty and does not constitute independent external validation. In either design, censoring and incomplete follow-up still affect whether a landmark outcome is observed. Grouping prevents patient overlap; it does not by itself correct outcome-label uncertainty, informative missingness, or a mismatch between the validation cohort and intended users.

When patients contribute multiple eligible landmarks, specify whether the evaluation target is a randomly selected landmark record or a randomly selected patient. The first gives more weight to patients with more rows; the second requires patient-level aggregation or weighting. Also specify how a patient with several validation landmarks contributes predictions. Those choices affect the interpretation of the resulting summary and should not be left to the data layout alone.

Common Mistakes

  • Splitting the landmark table by row. The mistaken reasoning is that a large number of rows guarantees a large validation sample. The correction is to count independent patients and assign each patient as a group.
  • Assuming grouped splitting eliminates every form of leakage. It prevents a patient’s rows from crossing partitions, but future measurements, global preprocessing, or validation-guided model selection can still leak information.
  • Balancing every row instead of patients. A patient with many rows can dominate row-based counts. Check event and covariate balance at the patient level, while preserving all records for each patient.
  • Calling random holdout validation external validation. A held-out subset from the same source can assess performance on unseen patients from a similar source; it does not establish performance in a new health system or time period.
  • Reporting the number of rows as the validation sample size. Report both the number of unique patients and the number of landmark records, because they describe different aspects of the evaluation data.
Key takeaway: For validation intended to represent new patients, the patient is the allocation unit. Assign unique patients first, keep all their landmark records together, and perform every data-adaptive modeling step using training data alone.

Check Your Understanding

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

  1. A patient contributes four landmark records. Under an independent row split with training probability \(0.75\), what is the probability that the patient appears in both training and validation?
  2. Why does assigning a patient’s early landmark to training and late landmark to validation fail to assess prediction for new patients?
  3. In grouped three-fold cross-validation, should a patient’s rows appear in the validation set in one fold and the training set in the other folds? Explain.
  4. A training set has 300 landmark rows from 50 patients, and validation has 100 rows from 20 patients. What additional split check is essential?
  5. Does a patient-level split address the use of biomarker measurements taken after a landmark to predict an outcome from that landmark? Why or why not?

Solutions. (1) The probability is \(1-0.75^4-0.25^4=1-0.316406-0.003906=0.679688\), or about 68.0%. (2) Both records carry information from the same person, so validation is not on a patient unseen during fitting. (3) Yes. Each patient is wholly held out in exactly one fold and can be included in the training sets for other folds; within any one fold, no held-out patient appears in training. (4) Verify that the 50 training identifiers and 20 validation identifiers are disjoint, and that every record for each identifier is assigned consistently. Row counts alone cannot establish this. (5) No. The split prevents patient overlap, but predictors must also be constructed using only information available by the landmark; post-landmark measurements are a separate temporal leakage route.

Clinical Biostats