Time-to-Event Data, Censoring, and Hazard Functions › Formula
Machine Learning from ScratchAll chapters Time-to-Event Data, Censoring, and Hazard Functions › FormulaSection view · Sections in this chapter4 / 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
In this section we build the notation from scratch. The destination is a single likelihood expression that correctly handles censored records, but the route matters. We first describe what a censored observation tells us, then introduce the three functions that describe a time-to-event distribution, then connect those functions through the hazard, and only then write the likelihood. Keeping that order in mind makes the formulas feel inevitable rather than arbitrary.
Event times, observation windows, and censoring
Let be the true time until an event, measured from a defined origin . For a pump, it could be working lifetime measured from installation. We assume here that is finite almost surely and has an absolutely continuous distribution, with and density . This excludes a point mass at zero and a permanently event-free fraction. Discrete event times and cure models require corresponding changes to the formulas.
We do not observe every subject's event time directly. Instead, each subject is followed over an observation window. Denote by the time, measured from the same origin, at which observation of subject ends if the event has not yet occurred. can come from an administrative cutoff ("the study ends in December"), from a dropout ("the patient moves to a different hospital"), or from a loss to follow-up. Whatever the mechanism, the data we record is the pair
where:
- : the true (latent) event time for subject , measured from the time origin
- : the potential censoring time for subject , the time observation would end if no event had occurred
- : the observed time, the smaller of the event and censoring times, so always
- : the event indicator, equal to one when the event is observed and zero when the record is censored
- : the indicator function, which equals one when its argument is true and zero otherwise
Here is the observed time and is the event indicator, equal to one if we saw the event and zero if the observation ended first. This single binary flag encodes a lot of information. means we know the exact event time, and means we only know . The pair is therefore the fundamental data unit of survival analysis. It is not a pair of unrelated numbers. It is a compressed statement about an event that either happened exactly at or had not yet happened by .
Right censoring means the event is later than a known bound. Left censoring means the event has already occurred but its exact time is unknown, so only an upper bound is recorded. Interval censoring gives bounds such as . Under an appropriate independent observation process, these contribute , , and respectively. They are different observation schemes, not interchangeable inputs to a right-censoring estimator. Ordinary missingness, with neither a known event time nor a valid bound, supplies less information than these records.
Delayed entry, or left truncation, is different from left censoring. A subject enters at age only if still event-free then: subjects with are absent from the observed cohort. For example, a registry that enrolls only patients alive several months after diagnosis selects survivors. We observe their entry ages and subsequent follow-up, and must account for the selection. Merely starting otherwise fully observed subjects on different calendar dates is not left truncation when each is followed from its own relevant time origin.
Survival, density, and hazard functions
With the data unit fixed, we need a way to describe how durations are distributed. Three functions do the job, and each answers a different practical question. The first is the survival function
This is the probability that the subject is event-free at time . We have , and as , . The survival function is non-increasing. It is the natural first object in survival analysis because a censored record does not tell us when the event happened. It tells us that the event had not happened before the observation ended. The survival function is exactly the probability of that kind of statement.
The second is the probability density function , which is the familiar object from Probability Distributions. The density is the derivative of the CDF, so integrating over an interval gives the probability that falls in that interval. It answers a different question from the survival function. Rather than "has the event happened yet?" it asks "how much probability mass sits near this particular time?" If every duration were fully observed, the density would be the most direct object to model.
The third is the hazard function
where:
- : the hazard function, the instantaneous event rate at time among those still at risk
- : the event time for a generic subject
- : a small positive time increment taken to zero in the limit
- : the conditional probability that the event occurs in the next increment, given survival to time
- the denominator converts that probability into a rate per unit time
Read this out loud: the hazard is the instantaneous rate at which the event occurs in the next tiny slice of time, given that it has not occurred yet. The conditioning event is what distinguishes the hazard from the density. The density measures the unconditional probability of the event near . The hazard measures the conditional intensity, so it captures how risky the next instant is for a subject who has survived up to . This conditional view is what makes censored data manageable. A censored subject contributes information about surviving up to the censoring time, and the hazard is the function that describes risk among exactly those survivors.
To express the hazard in terms of and , start from the definition of conditional probability. For small positive ,
The numerator is approximately because the density integrates to the probability over a short interval, and the denominator is for a continuous (equality holds because the point mass at is zero). Divide by and take the limit:
These equalities hold where and the required derivatives exist. The hazard is the negative log-derivative of the survival function. Here denotes the derivative of with respect to , and the final equality uses the chain rule for the logarithm, .
Because , integrating both sides from zero to gives
Since , we have and
Define the cumulative hazard , so the identity becomes
This identity connects survival probabilities and cumulative hazards for the continuous-time models considered here. It says that if we know the hazard at every time, we know the survival function by integration and exponentiation, and vice versa. It is also the reason hazard-based modeling is practical. We can write a model in terms of the hazard when event rates are the scientific target, and still evaluate the survival probability that the likelihood needs.
For a right-censored record, the event-time likelihood contribution is for an observed event and for censoring, after removing factors from an independent censoring mechanism that do not depend on . A density is not a point probability: for continuous times, , whereas measures density per unit time. Assuming independent subjects and the censoring conditions detailed next, the event-time likelihood, up to a parameter-free factor, is
Substituting ,
Taking logarithms turns the product into a sum:
where:
- : the log-likelihood as a function of the parameter vector
- : the event contribution, present only when
- : the negative cumulative hazard contribution, paid by every record whether event or censoring
This full log-likelihood is the starting point for the parametric right-censoring fits below; other estimators and observation schemes modify the objective. Every event contributes the log of the hazard at its event time. Every record contributes the negative cumulative hazard at its observed time, whether it was an event or a censoring. The formula is compact because the event indicator does exactly the bookkeeping we need. It switches on the density term for observed events and leaves only the survival term for censored records.
Censoring assumptions and delayed entry
The single likelihood in the previous section relies on one key factorization. If the event and censoring are independent random variables given covariates , that is,
where contains the conditioning covariates. For continuous censoring times, the joint density of , with respect to time and the binary indicator, is
Here and are the censoring density and survival function. If their parameters are distinct from , their factor can be removed when estimating . It depends on the event indicator as well as on time. Fixed administrative censoring has atoms rather than a continuous density, but conditioning on a predetermined independent follow-up schedule gives the same event-density and event-survival contributions. The product likelihood also assumes subjects are independent. Estimation beyond the observed follow-up range remains dependent on the model and on available support.
If conditional independence fails, removing the censoring mechanism is generally unjustified. Selective loss of subjects with poor prognoses can conceal early events, but the size and direction of distortion depend on the joint process and the target. Inverse-probability-of-censoring weights require conditional independence given measured history, positive probabilities of remaining observed over the target horizon, and an adequate censoring model. They do not identify unobserved dependence automatically. Joint models or sensitivity analyses address different additional assumptions. A dropout is not automatically a competing event; a competing event must preclude the event of interest under the chosen definition.
For delayed entry, suppose a subject is included only if , and is observed to . Under non-informative entry and censoring conditional on the relevant covariates, the event-time likelihood is conditioned on survival to entry. Its contribution is
where:
- : the delayed-entry (left-truncation) time at which subject first becomes observable, with
- : the probability that a subject with parameters survives to the entry time, the conditioning term
- the numerator is the ordinary density or survival contribution evaluated at from the original time origin; division by conditions it on survival to entry
The denominator conditions on the selection . Non-parametric methods implement this by admitting subjects to risk sets only after entry. It matters even for an exponential model: , giving exposure and, when and total post-entry exposure is positive, rate estimate , rather than . With no events and positive exposure there is no positive interior rate estimate; zero exposure also needs a separate report. For the six durations below, entry at would change exposure from to and the rate from to . Memorylessness preserves the exponential family for residual lifetime; it does not justify ignoring entry. Independence of entry and event time, possibly conditional on covariates, is an additional assumption and can fail in survivor cohorts.
Mathematical properties
Several properties follow directly from the definitions and are worth pinning down before we start estimating. They are not decoration. Each one will be used either to check an estimate or to simplify a likelihood.
- The survival function is non-increasing, right-continuous, satisfies , and tends to zero as . Accumulated failures can only reduce the probability of being event-free.
- The hazard is non-negative where it is defined, with . At a finite endpoint where survival reaches zero, the ratio is not defined.
- The cumulative hazard is non-decreasing with . As survival approaches zero, diverges; this can occur at a finite upper endpoint as well as in an infinite-time limit.
- The three representations are equivalent. Knowing any one determines the other two via and , or via .
- The expected event time satisfies , provided the integral is finite. This is the "survival-curve area" formula, and it is useful for comparing estimators.
- For ordered discrete event times, define . Then . The log cumulative hazard differs from the sum of discrete hazards ; one cannot substitute the latter into the continuous-time exponential identity exactly.
- If a covariate acts on the hazard as , where is the baseline hazard (the hazard when ) and is a regression coefficient, then is the log hazard ratio and . This is the proportional hazards structure we will develop in Cox proportional hazards.
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!