Time-to-Event Data, Censoring, and Hazard Functions › Practical Implications
Machine Learning from ScratchAll chapters Time-to-Event Data, Censoring, and Hazard Functions › Practical ImplicationsSection view · Sections in this chapter8 / 10 ↓
Reading tools Definitions, links & notes
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Time-to-event methods are most useful when the estimand is a duration and the observation process is explicit. The subsections below cover suitable applications, data preparation, common pitfalls, and computational and deployment considerations.
Appropriate Problems and Domains
Time-to-event methods apply when the target is a duration and the observation process supplies event times or valid censoring bounds. Equipment failure, subscription churn, credit default, and relapse can have that structure, provided the event, origin, population, and follow-up rule are defined. Event times can also be fully observed: censoring is an important reason for using survival methods, not a requirement for them.
When all durations are observed, an ordinary complete-data distributional fit may be sufficient. Light censoring is not, by itself, permission to ignore censored records. For a fixed-horizon question, such as relapse within twelve months, a binary classifier can be appropriate when status at that horizon is known for each subject. Censoring before the horizon leaves that label unknown and needs an explicit treatment.
A third consideration is the audience and the estimand. Hazard ratios describe relative rates of failure among those still at risk, survival probabilities describe the fraction event-free at a given time, and expected or median durations describe typical lifetimes. These answer different questions, and a model that reports one of them does not automatically answer the others without additional computation. Choosing the estimand before fitting is more efficient than fitting first and then searching for a summary that stakeholders can interpret.
Best Practices
Before analysis, record the time origin, event definition, observation-ending rule, and cohort inclusion or entry rule. Retain the observed duration, event indicator, entry time when relevant, and covariate measurement times. These decisions determine the target population and the information each record provides; model fitting cannot resolve an ambiguous event or an incorrectly defined origin.
A Kaplan–Meier survival estimate or Nelson–Aalen cumulative-hazard estimate can help assess a parametric model under their censoring and entry assumptions. A nearly linear cumulative hazard is consistent with an exponential model; marked curvature suggests a changing hazard. Thin risk sets limit interpretation in the tail. These are diagnostics, not proofs of a model or censoring assumption.
For iterative fits, inspect optimizer status, enforce parameter constraints, and compare sensible starting values. Compare information criteria using the same fitted records and observation scheme. Compare held-out likelihood by scoring candidate models on the same held-out records and observation scheme, and describe any differences in training data. Report event counts, follow-up, parameter count, and uncertainty alongside sample size. There is no universal events-per-parameter cutoff guaranteeing stability; the information also depends on effect sizes, covariate distributions, and censoring. Regularization can stabilize estimation but does not add information to the observed-data likelihood.
Data Requirements and Preprocessing
Durations need consistent units and a documented origin; hazards have inverse-time units. Zero durations can reflect rounding, simultaneous entry and event, or data errors, so investigate their meaning before fitting a model that assumes strictly positive times. Replacing them by an arbitrary epsilon changes the data. Ties from rounded measurement may be compatible with a chosen approximation, but genuine interval observation calls for interval-censoring methods rather than pretending the bounds are exact event times.
A baseline prediction model can use only covariates available at its prediction time. A measurement obtained three months later cannot be used as if available at baseline. Time-varying models can instead use information available just before each risk interval, with a suitable data layout and target. Standardizing a continuous covariate changes the unit represented by its coefficient: a hazard ratio per standard deviation differs from a ratio per original unit. With an unpenalized model and an equivalent parameter transformation, predictions and comparisons at the same original covariate values remain unchanged; regularization requires additional care.
A duration-and-indicator row supports basic right-censored models without delayed entry or time-varying covariates. Entry requires an additional field, and changing covariates commonly require start–stop risk intervals. When the target distinguishes multiple event types, retain an event-type field. A prespecified composite first-event target can instead use a binary event indicator. Different calendar recruitment dates alone do not imply left truncation when each subject is observed from its own defined origin.
Common Pitfalls
An analysis should explain why censoring is plausibly independent given the variables it uses. Related prognosis and observation-ending mechanisms can invalidate that assumption, but the direction of bias is not universal. Where dependence is plausible, choose a sensitivity analysis or a model whose additional assumptions address the mechanism. Censoring weights help only under their own conditional-independence, positivity, and model requirements.
A hazard is a rate and can exceed one. For an event-free subject at time , the probability of an event by is , when . For a constant rate , this is , whereas is only a small-interval approximation. Increasing the product does not make that linear approximation a valid probability.
Two further pitfalls concern the timing of the analysis rather than the algebra. When only a handful of subjects remain at risk, a single event can remove a large fraction of the estimated remaining survival probability. Such an unstable tail can look like a dramatic late effect when it is only sampling noise. Plots should display the number at risk beneath the curve, and statements about late survival should be qualified when that number is small. Separately, aligning subjects on different time origins, or allowing a covariate to be defined only for subjects who survived long enough to have it recorded, creates apparent effects that are artifacts of the study design. A fitted summary alone cannot establish that the data construction avoided these problems; inspect how the records were assembled.
Computational Considerations
The exponential rate estimate needs a single pass to accumulate events and exposure, followed by a division. Fits with unknown shape or regression coefficients commonly require iteration. A Weibull shape fit generally uses numerical root finding or optimization; a Cox fit evaluates a partial likelihood over risk sets. Iteration cost depends on the number of parameters and implementation, so an ordinary-regression runtime analogy is not a reliable complexity bound.
Non-parametric estimation has its own cost profile. Computing a Kaplan–Meier curve requires sorting the observed times, which is the dominant expense at , after which the cumulative product is a single linear pass. Nelson–Aalen is similar. Risk-set-based quantities that are recomputed from scratch for each event time can degrade toward quadratic behavior, which can become expensive as the sample grows. It is usually better to accumulate counts through the sorted event times than to filter the full sample at each step.
Use log-density and log-survival calculations to avoid multiplying probabilities that underflow. For the exponential model here, zero observed events and positive exposure give , whose supremum is at the boundary ; there is no positive interior rate estimate. Report that case explicitly rather than an arbitrary optimizer result. Other survival families need their own existence checks. Constraints and multiple starting points can help numerical fitting, but do not prove a global optimum.
Performance and Deployment Considerations
Mean squared error against censored durations evaluates the wrong event-time target. Censoring-aware concordance measures assess risk ordering among suitably comparable pairs; a chance ordering has expected concordance under the usual tie conventions. What constitutes useful discrimination depends on the application, so there is no universal threshold. Censoring-adjusted Brier scores assess probability error across supported horizons and reflect both calibration and discrimination. Held-out event-time likelihood remains useful for comparing parametric specifications on the same observations and observation process.
Deployment adds concerns that do not appear in a single fitted analysis. The survival function is time-dependent, so a deployed model must store its time origin and be queried with an elapsed time, not a calendar date. Mismatches here produce silently wrong predictions. Predictions should be reported with the horizon attached, since a survival probability without a time is meaningless, and predicted curves should be assessed against matured holdout outcomes at supported horizons to check calibration.
Monitor follow-up and censoring patterns as well as covariates and matured outcomes. A changing censoring fraction can reflect a newer cohort with less follow-up rather than a changed event process. Compare like horizons and cohort ages before interpreting drift, and reconsider censoring assumptions if the observation mechanism changes. Refitting and evaluation schedules should follow outcome availability and the application rather than a fixed generic cadence.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!