Evaluating Survival Predictions › Formula
Machine Learning from ScratchAll chapters Evaluating Survival Predictions › 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
Evaluation starts by fixing exactly what we observe, because censoring determines which comparisons are even possible. For units we observe a triple , where:
- is the true failure time of unit , unobserved when the unit is censored
- is the censoring time, the moment we stop observing the unit
- is the recorded follow-up time
- is the event indicator, equal to 1 when we saw the failure and 0 when the unit was censored
- is a vector of covariates
The pair is the part we see for every unit. The true failure time is only partly known: it is pinned down when and bounded below when .
Collecting the rows into a matrix and the follow-up times into a vector , an entire survival dataset is the pair plus . Evaluation also needs the model's risk scores or survival probability forecasts, the chosen horizons or cutoff, and a censoring model where IPCW is used. The observed outcomes alone do not determine a model's evaluation score.
Risk scores and survival probability predictions
A survival model can return two distinct products, and the difference between them is the key to choosing an evaluation metric. A risk score is a single number attached to unit , with the convention that larger means "fails sooner". A survival prediction is a function defined for every horizon . A risk score is a ranking device; a survival curve is a probability forecast.
The Cox proportional hazards model produces both. Its hazard specification is
where:
- : the hazard, the instantaneous failure rate at time for a unit with covariates
- : the unspecified baseline hazard, shared by all units
- : the covariate vector for a unit
- : the coefficient vector, one log hazard ratio per covariate
To turn a hazard into a survival function, we use the identity , where is the cumulative hazard (the integral of the hazard from to ). That identity holds because , so integrating both sides from 0 to and exponentiating recovers (using ). Applying it here, the covariate term factors out of the integral because it does not depend on time:
The linear predictor is the natural risk score for a Cox model, and in matrix form we write the whole vector of predictors at once as
where:
- : the vector of linear predictors, one per unit
- : the covariate matrix
- : the coefficient vector
- : the number of units
- : the number of covariates
For finite linear predictors, multiplies the same baseline hazard for every unit, so a larger gives a larger hazard multiplier. Its survival curve is no higher and, in exact arithmetic, is strictly lower wherever . Curves can coincide before the first baseline-hazard jump or at an endpoint where the cumulative hazard diverges and survival reaches zero. The linear predictor itself supplies a horizon-independent risk ordering. For crossing curves, a chosen horizon or another specified curve functional determines the ranking.
Accelerated failure-time models are specified on the log-time scale instead:
where:
- : the true failure time of a unit
- : the intercept on the log-time scale
- : the covariate vector for a unit
- : the coefficient vector on the log-time scale
- : a scale parameter
- : a standard Gumbel random variable for minima, independent of , with
Writing and , we can derive the survival function in a few steps. Starting from the definition and substituting,
The inner exponential simplifies because , using and . Hence
For an AFT model the linear predictor is a log-scale term, so a larger value means longer life and lower risk. The risk score must therefore be oriented in the opposite direction, for example , or equivalently . This sign convention is not cosmetic: reversing it turns a model with concordance above 0.5 into one with concordance below 0.5 (specifically, in the absence of ties), so a useful ranking is turned into a harmful one.
A risk score can be formed from a chosen functional of the survival curve, such as , a finite negative predicted median, or a negative restricted mean survival time. For a Cox model, preserves the linear-predictor risk ranking in exact arithmetic when ; lower survival means greater risk. Numerical underflow can collapse distinct survival predictions to zero, so use directly for Cox concordance when it is available. Step-function medians can introduce ties or remain undefined, so these choices need not give identical concordance in finite samples. For crossing curves, the chosen horizon can also change the ordering.
Concordance and comparable pairs
The concordance index asks a question about pairs of units: when the data tell us that unit failed before unit , does the model give the higher risk score? The whole subtlety is in the first clause, because censoring means the data often tell us nothing. The formula is therefore built around the idea of a comparable pair, a pair of units whose failure order is established by the observations themselves.
Consider a pair with . If , then exactly, and since , we can chain the inequalities to get , establishing . The ordering is therefore established by the data, and we call the pair comparable. Now suppose instead that . All we know is . It is entirely possible that lies between and , or beyond ; the data do not decide. The pair is not comparable and must be dropped. The same logic applies when and : then plays the role of the earlier, uncensored member and the pair is comparable with the roles reversed. Pairs where the earlier member is censored, and pairs where both members are censored, contribute nothing. The displayed rule deliberately excludes pairs with equal recorded times. Under our event-before-censoring convention, a failure and a censoring at the same recorded time can still reveal a strict failure order; that tied case is outside this rule.
Harrell's concordance index is a weighted fraction of comparable pairs that the model orders correctly, with a tie in the risk score counted as half credit:
where:
- : the estimated Harrell concordance index
- : the risk score for unit , with larger values meaning shorter predicted survival
- : the recorded follow-up time of unit
- : the event indicator for unit , equal to 1 when the failure was observed
- : the indicator function, equal to 1 when its argument is true and 0 otherwise
Reading the pieces: the outer sum runs over all ordered pairs; the indicator selects usable pairs and acts as a switch that zeroes out everything else; the two inner indicators give one full point for a correct ordering and half a point for a tie; and the denominator counts how many usable pairs there were, which turns the sum into an average. The numerator is credit, the denominator is opportunity, and Harrell's index is the fraction of available credit relative to opportunity that the model converts. The ratio is defined only when at least one comparable pair exists; otherwise its denominator is zero and the helper raises an error.
Without censoring, the estimator targets the population concordance with half credit for tied risk scores. Under censoring, Harrell's statistic instead targets the mix of comparable pairs selected by this study's follow-up pattern.
This target averages ranking credit over two independent units whose true failure times satisfy . Censored observations reveal only some such pairs, which is why Harrell's estimate can depend on follow-up.
When no observation is censored and failure times are distinct, every pair contributes to survival concordance. This is related to ROC AUC through time-dependent discrimination measures, but it is not generally the ordinary binary AUC at a fixed horizon. For example, times and risk scores give concordance and a binary AUC of at horizon .
Harrell's comparable-pair mix depends on censoring. Truncated IPCW concordance instead targets the ranking credit among true failure pairs with and . With continuous censoring, Uno's estimator uses inverse-square censoring weights. The formula below includes the tie-aware product needed under our event-before-censoring convention:
where:
- : truncated IPCW concordance, using Uno's inverse-square form when censoring is continuous
- : a fixed upper limit on the earlier failure time, inside positive censoring support
- : the censoring survival immediately before the failure time
- : the risk score for unit , with larger values meaning shorter predicted survival
- : the recorded follow-up time of unit
- : the event indicator for unit , equal to 1 when the failure was observed
- : the censoring survival estimated by reverse Kaplan–Meier; at a tied recorded time, original failures leave its risk set before the censoring jump
- : the censoring time, the moment observation of a unit stops
Choose a fixed truncation horizon with positive censoring survival throughout the evaluation window, and include only earlier failures with . For continuous censoring times, conditional on a qualifying latent pair with earlier failure time , the probability of observing that pair is , which explains the inverse-square weight. Under our convention , censoring ties require the more precise product : the failing unit needs , while the comparison unit needs . The pooled weights used here assume that is independent of the joint pair .
Censoring weights and time-dependent Brier scores
Concordance only needs a ranking, so it can ignore the actual probability values. The Brier score cannot. At horizon it measures squared error on the probability scale:
where:
- : the Brier score at horizon , the mean squared error of the survival probability forecast
- : the number of units in the evaluation sample
- : the realised outcome for unit , equal to 1 if unit survives past and 0 if it fails by then
- : the model's predicted probability that unit survives past
- : the true failure time of unit , which is only partly observed under censoring
is the realised outcome: 1 if unit is still running at , 0 if it has failed by then. With fully observed outcomes this is just the mean squared error of a probability forecast, and it is minimised in expectation by the true conditional survival probability. This makes the Brier score a proper probability score. Its aggregate value does not identify calibration alone, so we also compare observed and predicted probabilities within groups.
Censoring hides for part of the sample. Under our event-before-censoring convention, four cases describe what is known:
- If and , the unit failed by , so is known.
- If , the unit was observed past , so is known.
- If and , then , so is also known.
- If and , the unit was censored before the horizon, so is unknown.
The naive fixes are to drop those units, score them as survivors, or score their censoring times as failures. These operations make different unsupported assumptions about outcomes that were not observed.
Inverse probability of censoring weighting divides each observed outcome contribution by its observation probability. Under censoring independent of failure time and prediction covariates, with . The left limit matters when censoring and failure times can tie; with continuous censoring times it equals .
The in the denominator cancels the probability of observing a failure at , so each observed failure represents units. For the survivor term, we deliberately select units observed strictly past : . Under the stated independence assumptions and , even if censoring has an atom at . A unit censored exactly at has a known survivor outcome, but is excluded by this selection rule. An inclusive rule would instead select and divide by ; that alternative is not the estimator implemented below.
Applying both identities term by term gives the Graf estimator, the standard IPCW Brier score:
where:
- : the estimated Brier score at horizon
- : the number of units in the evaluation sample
- : the model's predicted survival probability for unit at horizon
- : the recorded follow-up time of unit
- : the event indicator for unit , equal to 1 when the failure was observed
- : the estimated survival function of the censoring distribution, evaluated at time
The first term collects observed failures by : their squared error is , with weight . The second term selects units observed strictly past : their squared error is , with weight . Units censored at or before contribute zero to this particular estimator, although censoring exactly at reveals a survivor outcome. With true censoring probabilities, positive support, and the stated independence assumptions, these selected weighted contributions recover the population Brier error in expectation. For a fixed probability forecast and independent, identically distributed evaluation units, an oracle law of large numbers makes the true-weight average converge to that expectation. One sufficient condition for estimated weights to reach the same target is uniform consistency of the required censoring probabilities, including their left limits, with the true probabilities bounded away from zero over the evaluation window. Uniform control keeps the reciprocals controlled; pointwise consistency alone does not guarantee this. For a forecast fitted on independent training data, condition on the fit and target that fitted forecast's population Brier error. The identity is not a promise that a finite sample uses every known outcome or has no information loss.
For this strict Brier estimator, require and at contributing failure times ; the implementation also checks their estimated counterparts. Very small values can make inference unstable. For general covariate-dependent losses, the pooled Kaplan–Meier censoring weights used here are justified under the sufficient condition that is independent of the joint pair . If failure and censoring are only conditionally independent given , use a correctly specified conditional censoring model in each unit's weights instead. A training-based censoring model also needs to describe the evaluation population. When the horizon is not fixed in advance, the integrated Brier score summarises the path:
where:
- : the estimated integrated Brier score over the full follow-up window
- : the largest horizon included in the integration, the upper end of the evaluation window
- : the estimated IPCW Brier score at horizon
- : the -th point of the integration grid, with ; for a window such as the implementation's , integrate over that window and divide by
- : the number of grid points
This is the trapezoid rule applied to the grid. Reading the right-hand side: each trapezoid's area is its average height times its width, and dividing the total by normalises the integral to the scale of a single Brier score. The factor in front plays the role of the in the integral definition , so the trapezoid approximation lands on the same scale.
Mathematical properties
- With finite nonnegative pair weights and a positive comparable-pair denominator, concordance lies in . Conditional on those pairs and weights, an independent random ranking with exchangeable score pairs gives in expectation, including when tied scores receive half credit. In exact arithmetic, a strictly increasing transformation on the score's domain preserves its pairwise rankings and ties. Examples include positive rescaling, exponentiation over the real numbers, and a logarithm when every score is positive; nonpositive rescaling or a transformation that merges distinct scores need not preserve concordance.
- When at least one comparable pair contributes positive weight, a constant risk score gives concordance because every contributing pair receives half credit. This includes a marginal Kaplan–Meier baseline. With no contributing pair, Harrell or truncated IPCW concordance is undefined rather than .
- Harrell's concordance depends on the censoring distribution through the set of comparable pairs. Uno's concordance targets a censoring-independent quantity but requires independent censoring and a positive censoring survival function.
- With the true censoring probabilities and the stated independence assumptions, the IPCW Brier score has the same expectation as the complete-outcome Brier score, minimised by the true conditional survival probability. Under the consistency and reciprocal-control conditions stated above, estimated weights recover this target asymptotically; they do not give an exact finite-sample unbiasedness guarantee.
- For a binary horizon outcome and probability forecast , let and . Here means survival past the horizon, so is the marginal survival probability. The expected Brier score is . The reliability term measures the gap between each forecast and the conditional probability at that forecast level; the resolution term measures how those conditional probabilities vary. The uncertainty term is the marginal outcome variance. It is not a lower bound on prediction error, because informative forecasts can offset it through resolution. Exact forecast levels, or groups with a constant forecast, give this identity; coarse bins with varying forecasts require additional terms. This probability-score decomposition does not turn concordance into a calibration measure: concordance uses pairwise ranking credit rather than squared probability errors.
- In finite samples the IPCW Brier estimator can fall outside , because a small can make a single term large; small censoring survival can increase its variance, with the effect depending on the forecasts and event distribution.
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!