Inverse-probability censoring weights correct a particular missing-outcome pattern only while the probability of remaining observed is estimable and positive.
Censoring survival weights and horizon support
Model disappearance as its own event
For a resolution model, ordinary case resolution is the outcome event; loss of observation is censoring. To estimate the censoring survival function G(t), reverse that indicator: a lost case is an event in the censoring model and a resolved case leaves its risk set without a censoring event. Administrative extraction at a shared cutoff may create many losses at one time. Record why follow-up ended rather than pooling operational dropout with a planned study close without inspection.
Keep the two sides of a time point distinct
At a prediction horizon h, a case resolved at time t no later than h contributes using G(t-) in a standard time-dependent Brier construction; a case known open beyond h contributes using G(h). G(t-) is the probability of remaining uncensored immediately before t. Simultaneous resolution and censor times require a documented convention. This lesson uses distinct times in its fixture and returns the stepwise censoring survival after each loss.
Refuse an unsupported horizon
If G(h) approaches zero, surviving cases receive very large weights. If G(h) is zero, the score is undefined under this estimator. A data set with almost no twelve-day follow-up cannot support a twelve-day validation claim by assigning extreme weights. Report the at-risk count, censor count and G(h) along the chosen horizon. Choose the horizon before looking for the best-looking score. Tail-support checks apply to the censoring curve too.
State the assumption
A marginal censoring curve assumes that, after conditioning on whatever the method models, disappearance does not carry unmeasured information about resolution. If complex cases stop reporting status more often, a pooled weight may be wrong even with positive G. Consider a censoring model using variables available before disappearance and inspect its calibration, while avoiding predictors measured after loss. Weights address incomplete follow-up; they do not fix target leakage or a wrong outcome definition.
Use established estimators for release
The small routine below is a transparent step calculation. A production evaluation should use a maintained implementation with tie handling, appropriate training data for estimating censoring, and confidence intervals. Check that the test horizon lies inside the supported follow-up range. The scoring lesson uses these probabilities on a no-ties fixture.
Implementation
def censoring_steps(case_outcomes):
if len({case_id for case_id, _, _ in case_outcomes}) != len(case_outcomes):
raise ValueError("duplicate case ID")
if any(hour <= 0 or resolved not in (0, 1)
for _, hour, resolved in case_outcomes):
raise ValueError("invalid observation")
if len({hour for _, hour, _ in case_outcomes}) != len(case_outcomes):
raise ValueError("teaching fixture requires distinct times")
at_risk = len(case_outcomes)
censor_survival = 1.0
steps = []
for _, hour, resolved in sorted(case_outcomes, key=lambda item: item[1]):
before = censor_survival
if not resolved:
censor_survival *= 1 - 1 / at_risk
steps.append((hour, before, censor_survival))
at_risk -= 1
return steps
ledger = [("R421", 2, 1), ("R422", 4, 0), ("R423", 6, 1),
("R424", 8, 0), ("R425", 11, 1)]
steps = censoring_steps(ledger)
assert steps[1] == (4, 1.0, 0.75)
assert steps[3][2] == 0.375Performance and operating cost
Sorting N records costs O(N log N) time and O(N) output space; the step calculation itself is O(N). Weight variance can dominate numerical runtime: late horizons with few observed cases produce unstable estimates regardless of a fast implementation.
Common Mistakes
- Do not treat resolution as a censoring event when estimating G.
- Do not evaluate beyond the range where G remains positive.
- Do not assume a marginal censoring curve removes informative dropout.
