Survival kaplanmeiercurve equals - 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

KaplanMeierCurve.Equals

Compares the steps and all three curves, element by element.

public bool Equals(KaplanMeierCurve other)

Parametersother is the curve to compare against, or null.

Returnstrue when the confidence level matches and the steps, estimates and both bounds hold the same values.

Example — the same curve, built twice.

using Lodestar.Survival;

SurvivalStep[] steps = [new(0.0, 4, 0, 0), new(1.0, 4, 1, 0)];
KaplanMeierCurve left = new(steps, [1.0, 0.75], [0.4, 0.3], [0.9, 0.8], 0.95);
KaplanMeierCurve right = new(
    [new(0.0, 4, 0, 0), new(1.0, 4, 1, 0)], [1.0, 0.75], [0.4, 0.3], [0.9, 0.8], 0.95);

bool same = left == right;  // => True

RemarksSurvivalStep is a record of value types, so its own equality is already correct; what needed writing is the comparison of the arrays holding it. the equality rule has the rule.

Applies to — net10.0, netstandard2.0.

See alsoKaplanMeierCurve.GetHashCode, KaplanMeierCurve.