plot_survival_calibration

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

plot_survival_calibration(time: ndarray, event: ndarray, predicted: ndarray, *, horizon: float, n_groups: int = 5, time_label: str = 'Time')[source]

Calibration of the predicted horizon survival against Kaplan-Meier truth.

Subjects are binned by their predicted probability of surviving past horizon; for each bin the mean prediction is plotted against the observed Kaplan-Meier survival at that horizon. Points on the diagonal mean the predicted and observed risks agree.

Parameters:
  • time – Observed follow-up durations.

  • event – Event indicators, True for observed events.

  • predicted – Per-subject predicted probability of surviving past horizon (values in [0, 1]).

  • horizon – The time horizon the predictions refer to.

  • n_groups – Number of predicted-risk bins.

  • time_label – Time units, used in axis annotation (sanitised).

Returns:

The matplotlib Figure.