Skip to content

Support calibration under independent censoring - #298

Merged
uriahf merged 4 commits into
mainfrom
agent/independent-censoring-calibration
Aug 12, 2026
Merged

Support calibration under independent censoring#298
uriahf merged 4 commits into
mainfrom
agent/independent-censoring-calibration

Conversation

@uriahf

@uriahf uriahf commented Aug 12, 2026

Copy link
Copy Markdown
Owner

What changed

  • supports censoring_heuristic="adjusted" when censored observations are present
  • estimates discrete calibration points with within-bin Aalen–Johansen risks (equivalent to 1 - KM without competing events)
  • estimates smooth calibration curves from leave-one-out Aalen–Johansen pseudo-observations
  • applies competing-event heuristics only to events on or before the calibration horizon
  • keeps competing events after the horizon in the event history so pre-horizon risk sets remain correct
  • keeps polarstate and pseudostate unchanged
  • avoids pseudo-observation computation for discrete-only curves
  • fixes single-model time-calibration trace naming and keeps tied predictions in the same calibration group

Why

Time-dependent calibration previously rejected adjusted censoring whenever censored observations were present. Under independent censoring within the prediction groups/range, Aalen–Johansen/Kaplan–Meier estimates provide the appropriate observed risks, while AJ pseudo-observations support smoothing.

pseudostate currently requires Python 3.13 while rtichoke supports Python 3.9+, so this PR performs the same leave-one-out AJ calculation internally using the existing polarstate dependency. The adapter can be replaced later if package version constraints align.

Validation

  • full suite: 36 passed
  • discrete survival calibration matches lifelines.KaplanMeierFitter
  • discrete competing-risk calibration matches lifelines.AalenJohansenFitter
  • individual pseudo-observations match independently recomputed leave-one-out lifelines AJ estimates
  • regression coverage confirms competing events after the horizon are retained
  • ruff check src tests: passed
  • formatting check for changed files: passed
  • targeted ty check for changed files: passed

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-12 12:38 UTC

@uriahf
uriahf marked this pull request as ready for review August 12, 2026 12:36
@uriahf
uriahf merged commit aebe8a7 into main Aug 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant