Survival nelsonaalen estimate - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Survival is 0.1.0 — read its documentation.

HomeSurvivalSurvival estimators

NelsonAalen.Estimate

The cumulative hazard of a right-censored sample.

public static NelsonAalenCurve Estimate(ReadOnlySpan<double> durations, ReadOnlySpan<bool> eventObserved)

Parametersdurations holds one non-negative time per subject; eventObserved is true where that time ends in the event. The two spans must be the same length.

Returns — a NelsonAalenCurve whose Steps and CumulativeHazard share one index.

ExceptionsArgumentException when the spans differ in length, the sample is empty, or a duration is negative or NaN.

Example — the increment at a time with three tied events.

using Lodestar.Survival;

NelsonAalenCurve curve = NelsonAalen.Estimate([6, 6, 6, 7], [true, true, true, true]);

double atSix = curve.CumulativeHazard[1];  // => 1.083…

Remarksthe increment is not d/n. With d events tied at one time it is the sum of 1 / (n - i) over those events, as though they had been separated by an instant each. Three events among 21 at risk give

1/21 + 1/20 + 1/19 = 0.150251     and not     3/21 = 0.142857

which is a 5% difference at the very first step of the Freireich arm. This is the tie correction lifelines applies by default, and it is the single place an implementation written from the plain definition will disagree with it. The frozen corpus is what caught it here — five of the nine samples carry ties on purpose for that reason.

Censorings contribute nothing to the sum and everything to the denominators after them, which is the same mechanism Kaplan-Meier uses and why the two share a step table.

Applies to — net10.0, netstandard2.0.

See alsoNelsonAalen, KaplanMeier.Estimate.

⚠️ **GitHub.com Fallback** ⚠️