Skip to content
AITroveRead. Build. Understand.
Make this comfortable

Kaplan–Meier curves for support resolution

Last updated: 5 Oct 20265 min read
tutorial
IntermediateBy AITrove Editorial

The Kaplan–Meier product estimates the chance a case remains unresolved beyond each observed resolution time under a suitable censoring assumption.

Choose the event and interpret the axis

Here the event is resolution. The estimated survival function S(t) means the probability that resolution has not happened by time t; it is an unresolved-case curve, not a customer-survival curve. Start at S(0)=1 for a cohort observed at creation. With the eight-case event table, multiply the current estimate by 1 minus resolved divided by at risk at each event time. A censor changes a later denominator but creates no step at its own time. The risk-set table fixes tie handling.

Work through a nontrivial tie

At day two, S becomes 7/8, or 0.875. Day three has seven at risk, one resolution and one censor; multiply 0.875 by 6/7 to get 0.75. At day five, five at risk and one resolution yield 0.60. Day eight yields 0.40; day ten yields 0.20. The day-three and day-five censors remain in the same-time denominator and leave afterward. This calculation differs from dividing cumulative resolved cases by the original eight because censored cases stop contributing later exposure.

Read fixed horizons with care

By day six the curve is still at 0.60, so the estimated resolution probability by that horizon is 0.40 in this illustrative cohort. State the horizon and the number at risk nearby. A flat tail after the last event is not proof that the eventual resolution probability has stopped changing; no later events may be observable. If a service target is day six, report its cohort definition and cutoff maturity before comparing queues.

Name the censoring assumption

Administrative censoring at a planned extraction date is often easier to defend than censoring caused by a case disappearing from the system. The estimator needs censoring to be sufficiently independent of the future resolution time, conditional on relevant grouping variables. If escalated cases are selectively removed from the extract, the curve can be optimistic. A plotted line cannot detect that design failure. Complete-case selection is a related warning.

Use the right estimator for the question

One minus S(t) is useful when resolution is the only event that ends follow-up and other exits are genuine censoring. If cancellation prevents later resolution, treating cancellation as censoring can overstate the observed-world chance of resolution. Use competing-risk incidence for that question. If the decision concerns average time spent open through a finite horizon, use restricted mean unresolved time.

Implementation

python
def unresolved_curve(event_rows):
    unresolved_share = 1.0
    points = []
    for day, at_risk, resolved, censored in event_rows:
        if at_risk <= 0 or min(resolved, censored) < 0 or resolved + censored > at_risk:
            raise ValueError("invalid event table")
        unresolved_share *= 1 - resolved / at_risk
        points.append((day, unresolved_share, at_risk))
    return points

rows = [(2, 8, 1, 0), (3, 7, 1, 1), (5, 5, 1, 1),
        (8, 3, 1, 0), (10, 2, 1, 1)]
curve = unresolved_curve(rows)
assert [round(point[1], 3) for point in curve] == [0.875, 0.75, 0.6, 0.4, 0.2]
day_six_unresolved = next(value for day, value, _ in reversed(curve) if day <= 6)
assert round(1 - day_six_unresolved, 2) == 0.4

Performance and operating cost

Given a sorted table of U distinct outcome times, curve calculation costs O(U) time and O(U) output space. Keeping only one requested horizon can use O(1) additional space. The statistical limit is thin late risk sets, not run time.

Common Mistakes

  • Do not call S(t) the resolution probability when resolution is the event.
  • Do not interpret a flat censored tail as a measured long-run plateau.
  • Do not use one minus Kaplan–Meier as observed-world incidence with competing exits.

Read next

Continue the workflow: Survival-curve uncertainty and thin-tail support.

Continue the workflow: Cox partial likelihood and hazard-ratio interpretation.

Continue the workflow: Aalen–Johansen cumulative incidence from case events.

ai-data
data-science
Storage details