Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Logarithmic Scores for Event-Risk Predictions

Calibration and Prediction Validation · Tutorial 568 of 697

Logarithmic Scores for Event-Risk Predictions

Learn to calculate a censoring-aware logarithmic score for event-risk predictions, interpret its penalty for confident errors, and check when the score is trustworthy.

Advanced 11 min read

What You'll Learn

  • Define the horizon-specific logarithmic score for predicted event risks
  • Construct an inverse-censoring-weighted estimate when event status is incompletely observed
  • Derive the censoring adjustment under conditional independent censoring
  • Calculate and interpret weighted scores using hypothetical data
  • Explain why confident incorrect predictions receive especially large penalties
  • Identify positivity, censoring-model, and numerical problems that can distort the score

Why Score Probabilistic Event-Risk Predictions?

A survival model may assign each person a probability of experiencing the event by a chosen horizon. Evaluating those probabilities requires more than checking whether the model ranks people correctly: a prediction of 0.8 and a prediction of 0.55 are different statements about risk, even if both rank the person above someone else. A logarithmic score evaluates the probabilities themselves and rewards predictions that assign high probability to what actually happens.

Censoring complicates this evaluation. At a horizon of two years, for example, a person censored after one year has unknown two-year event status. Treating that person as event-free would be incorrect. The censoring-aware score uses inverse-probability weights to account for the fact that some outcomes are observed only when censoring has not already occurred.

Definition: At a fixed horizon \(t\), let \(p_i(t)\) be the predicted probability that person \(i\) experiences the event by \(t\), based on information available when the prediction is made. The horizon-specific logarithmic loss for a known event indicator \(D_i(t)=I(T_i\leq t)\) is $$ \ell_i(t)=-D_i(t)\log p_i(t)-\{1-D_i(t)\}\log\{1-p_i(t)\}. $$ Lower loss is better. The logarithm is natural, so loss is measured in nats.

An event by the horizon incurs loss \(-\log p_i(t)\); remaining event-free through the horizon incurs loss \(-\log\{1-p_i(t)\}\). Thus, the score is sensitive both to whether predictions are accurate and to how much probability they assigned to the outcome that occurred. It is a score for probabilistic accuracy, not a measure of discrimination alone.

Correcting the Score for Right Censoring

Suppose \(T_i\) is the event time and \(C_i\) is the censoring time. We observe \(U_i=\min(T_i,C_i)\) and \(\Delta_i=I(T_i\leq C_i)\). An event by \(t\) is known if \(\Delta_i=1\) and \(U_i\leq t\). Event-free status through \(t\) is known if \(U_i>t\). Someone censored at or before \(t\) without an observed event has unknown status at the horizon and does not receive a direct loss contribution.

Let \(Z_i\) denote the information used to account for censoring, including relevant predictors available at prediction time. Write \(G(s\mid Z_i)=P(C_i>s\mid Z_i)\). For simplicity, assume censoring times are continuous; in settings with ties, the survival-function limits and event-time convention must be defined consistently. The estimated censoring-adjusted mean logarithmic loss is

$$ \widehat L_{\log}(t)=\frac{1}{n}\sum_{i=1}^n\left[ \frac{\Delta_i I(U_i\leq t)}{\widehat G(U_i-\mid Z_i)} \{-\log p_i(t)\} + \frac{I(U_i>t)}{\widehat G(t\mid Z_i)} \{-\log(1-p_i(t))\} \right]. $$

The first term scores observed events by the horizon, weighting each by the inverse estimated probability of remaining uncensored until the event time. The second scores people observed event-free beyond the horizon, weighting each by the inverse probability of remaining uncensored through \(t\). A censored person with no observed event by \(t\) contributes zero directly. The divisor is \(n\), not the sum of the observed weights: this inverse-probability form targets average loss per person in the evaluation population.

Assumptions for the censoring adjustment: Within levels of \(Z_i\), censoring is independent of the event time, so \(C_i\) and \(T_i\) are conditionally independent given \(Z_i\). The censoring survival probability must be positive through the times being scored: \(G(s\mid Z_i)>0\) for relevant \(s\leq t\). The predictions and censoring model must apply to the same target population and prediction time. If censoring depends on observed predictors, the censoring model should account for them; unconditional weights are not generally sufficient.

Why the Weighting Works

The score is based on the target loss that would be available if event status at \(t\) were known for everyone. The weights correct the selection created when only people who remain uncensored long enough have known status. Here is the justification, conditional on \(Z_i\), under the assumptions above.

1
Observed events.
For a person whose event time is \(s\leq t\), the event is observed with probability \(G(s-\mid Z_i)\). Multiplying the event indicator by its inverse probability gives conditional expectation \(G(s-\mid Z_i)/G(s-\mid Z_i)=1\).
2
Known event-free status.
For a person with \(T_i>t\), event-free status through \(t\) is observed with probability \(G(t\mid Z_i)\). Its inverse-weighted indicator also has conditional expectation \(G(t\mid Z_i)/G(t\mid Z_i)=1\).
3
Recover the target average.
Each known outcome’s weighted contribution therefore has the same expectation as its full-data loss contribution. Averaging over people estimates the mean horizon-specific logarithmic loss, with the censoring distribution estimated in practice.

This argument explains both the method and its vulnerability. If censoring is informative even after conditioning on \(Z_i\), the observation probabilities used in the weights do not correctly describe which outcomes are observed. If the probabilities are near zero, a few observed people receive very large weights and can dominate the estimate.

Worked Example: Computing a Censoring-Adjusted Score

Suppose a hypothetical validation sample has four people and the prediction horizon is two years. The estimated censoring probabilities and prediction data are as follows. Assume the censoring model is appropriate and that the required probabilities are positive.

PersonPredicted risk \(p_i(2)\)Observed outcome by two yearsWeight denominator
A0.80Event at 1 year\(\widehat G(1-\mid Z_A)=0.80\)
B0.20Observed event-free past 2 years\(\widehat G(2\mid Z_B)=0.50\)
C0.70Censored at 1.5 years, no event observedNo contribution
D0.40Event at 1.5 years\(\widehat G(1.5-\mid Z_D)=0.60\)

For A, the event loss is \(-\log(0.80)=0.2231\). Its weighted contribution is \(0.2231/0.80=0.2789\). For B, the event-free loss is \(-\log(1-0.20)=-\log(0.80)=0.2231\), giving \(0.2231/0.50=0.4463\). Person C’s two-year status is unknown, so C contributes no directly observed loss. For D, the event loss is \(-\log(0.40)=0.9163\), giving \(0.9163/0.60=1.527\).

Therefore, $$ \widehat L_{\log}(2)=\frac{0.2789+0.4463+0+1.527}{4}=0.5631\text{ nats per person}. $$ This is an estimate of mean two-year logarithmic loss, not the loss of any one person. The censoring weights increase the influence of outcomes that were less likely to be observed.

Why Confident Errors Are Penalized Strongly

For a known binary outcome with true event probability \(q\), the expected logarithmic loss from predicting \(p\) is

$$ E(\ell\mid q)=-q\log p-(1-q)\log(1-p). $$

Differentiating with respect to \(p\) gives

$$ \frac{\partial E(\ell\mid q)}{\partial p} =-\frac{q}{p}+\frac{1-q}{1-p} =\frac{p-q}{p(1-p)}. $$

For \(0<q<1\), this derivative is zero at \(p=q\), negative when \(p<q\), and positive when \(p>q\). The second derivative is \(q/p^2+(1-q)/(1-p)^2>0\), so the expected loss is minimized at the true probability. This establishes the strict propriety of the logarithmic score: in expectation, truthful probabilities give the lowest loss.

Worked Example: Comparing a Confident Error With a Moderate Error

Consider a hypothetical person who experiences the event before the horizon. A model predicting \(p=0.01\) assigns that observed event loss $$ -\log(0.01)=4.605\text{ nats}. $$ A model predicting \(p=0.40\) assigns the same event loss $$ -\log(0.40)=0.9163\text{ nats}. $$ The first model is penalized much more because it assigned only one percent probability to the outcome that occurred. If the event was observed at a time when the relevant censoring probability was \(0.80\), the corresponding weighted contributions are \(4.605/0.80=5.756\) and \(0.9163/0.80=1.145\). The relative penalty remains, while the weight adjusts for outcome observability.

The rule also rewards confident correct predictions: for an observed event, \(p=0.99\) gives loss \(-\log(0.99)=0.01005\) nats. But probabilities exactly zero or one can give infinite loss when wrong. This is why model implementations should avoid accidental numerical zeros and ones and document any probability-clipping rule.

Interpretation, Diagnostics, and Alternatives

A lower censoring-adjusted logarithmic score indicates better average probabilistic accuracy at the specified horizon, for the population and prediction setting being evaluated. Scores can be compared only when they use the same horizon, outcome definition, evaluation population, censoring adjustment, and logarithm convention. Unlike a risk ratio or a calibration slope, the score is not itself an effect size with a natural clinical unit. It also does not reveal whether any improvement came from calibration, discrimination, or both.

The Integrated Brier Score in Joint Models is a useful alternative overall prediction metric. Its squared-error penalty is less sensitive than logarithmic loss to assigning an extremely low probability to an event that occurs, or an extremely high probability to an event-free outcome. The logarithmic score’s stronger penalty is valuable when overconfident errors matter, but it can make results sensitive to a small number of extreme predictions or large censoring weights.

Before interpreting a score, check the censoring model and the weights as well as the predictions. Useful diagnostics include examining the range and distribution of \(\widehat G\), identifying very large inverse weights, and checking whether censoring is plausibly independent of event time after conditioning on the information used. A lack of positivity—such as no one remaining under observation to a late horizon in a predictor subgroup—means the target loss there is not reliably recoverable from these data. A misspecified censoring model can bias the score even when the event-risk model is accurate.

A further pitfall is to assign censored people the event-free loss simply because no event was observed before censoring. For someone censored before \(t\), the outcome by \(t\) is unknown; using \(-\log\{1-p_i(t)\}\) treats missing status as a known negative outcome. The correction is to omit that direct contribution and use the censoring-adjusted terms for observed cases and observed event-free people.

Key takeaway: The censoring-aware logarithmic score estimates horizon-specific mean probabilistic loss by inverse-weighting observed events and observed event-free outcomes. Its validity depends on an appropriate censoring model and adequate probability of remaining uncensored; its logarithmic penalty makes confident errors costly.

Check Your Understanding

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

  1. At a fixed horizon, an individual has predicted event risk 0.25 and is known to remain event-free through that horizon. What is the unweighted logarithmic loss?
  2. Why does a person censored before the horizon, without an observed event, not receive an event-free loss contribution?
  3. For an observed event with predicted risk 0.10 and censoring probability at the event time of 0.50, calculate the weighted contribution.
  4. Name two conditions needed for the inverse-censoring-weighted score to estimate the target mean loss.

Solutions. (1) The loss is \(-\log(1-0.25)=-\log(0.75)=0.2877\) nats. (2) The person’s event status at the horizon is unknown; censoring before the horizon does not establish that the person remained event-free through it. (3) The event loss is \(-\log(0.10)=2.303\) nats, and the weighted contribution is \(2.303/0.50=4.605\) nats. (4) Among acceptable conditions are conditional independence of censoring and event time given the information used in the censoring model, and positivity of the censoring survival probability through the horizon and relevant event times.

Clinical Biostats