Survival coxsummary - CyrilB1531/lodestar GitHub Wiki

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

Home › Survival › Survival estimators

CoxSummary

What a Cox proportional hazards fit reports, at lifelines parity.

public sealed class CoxSummary

Properties — the per-covariate lists are parallel and in the design's column order:

  • Coefficients are the log hazard ratios.
  • StandardErrors are the square roots of the inverse observed information's diagonal.
  • ZStatistics is each coefficient over its standard error.
  • PValues are two-sided, from the normal tail.
  • ConfidenceLower and ConfidenceUpper are each coefficient's interval at ConfidenceLevel.
  • HazardRatios, HazardRatioLower and HazardRatioUpper are the exponentials of the three above.

For the model:

  • LogLikelihood is the log partial likelihood at the fit, and NullLogLikelihood the same with every coefficient zero.
  • LikelihoodRatioStatistic is twice their difference, and LikelihoodRatioPValue its chi-squared tail on LikelihoodRatioDegreesOfFreedom degrees, one per covariate.
  • ConcordanceIndex is Harrell's C.
  • ConfidenceLevel is the level the intervals were built at.
  • Robust says whether the standard errors, and everything built on them, are the sandwich.
  • CovariateMeans are the covariates' means in the fitted sample, where the partial hazards are centred.
  • Baselines holds one CoxBaseline per stratum, labels ascending; one, labelled zero, when the fit is unstratified, and one pooled over the strata for a CoxTimeVarying fit, as lifelines' time-varying fitter computes it.

Example — the model as a whole, beside one covariate.

using Lodestar.Survival;

double[] design = [1.0, 0.0, 2.0, 1.0, 1.5, 0.0, 3.0, 1.0, 2.5, 0.0,
                   0.5, 1.0, 2.0, 0.0, 1.0, 1.0, 3.5, 0.0, 0.5, 1.0];
double[] months = [12, 5, 20, 3, 15, 9, 8, 14, 2, 18];
bool[] died = [true, true, false, true, true, true, true, false, true, true];

CoxSummary summary = CoxProportionalHazards.Fit(design, months, died, featureCount: 2);

double treatmentP = summary.PValues[1];                      // => 0.14391…
double modelP = summary.LikelihoodRatioPValue;               // => 0.05068…
double concordance = summary.ConcordanceIndex;               // => 0.77380952380952…
int degrees = summary.LikelihoodRatioDegreesOfFreedom;       // => 2

Remarks — a hazard ratio is per unit of its covariate. Above, 4.07 is per milligram of dose, so the same data coded in grams reads 4.07 to the thousandth power. The p-value does not change with units; the ratio does.

The concordance counts a pair of identical linear predictors as one half, as Harrell's rule and lifelines' own documentation state. lifelines computes the partial hazard with row-dependent rounding, so two subjects with identical covariates can compare strictly there. On the ten patients above it reports 0.7857 where the rule gives 0.7738. The two identical rows are the sixth and the tenth.

There is no iteration count: the reference reaches its answer under a different stopping rule, so no oracle could check one, and a fit that did not converge throws rather than returning. A class rather than a record, as OlsSummary is: two fitted tables are not values a caller compares.

Applies to — net10.0, netstandard2.0.

See also — CoxProportionalHazards.Fit.

Members

Member What it does
CoxSummary.PredictCumulativeHazard Each subject's cumulative hazard at given times.
CoxSummary.PredictExpectation The area under each subject's survival curve over the observed span.
CoxSummary.PredictLogPartialHazard Each subject's centred linear predictor.
CoxSummary.PredictMedian Each subject's median survival time.
CoxSummary.PredictPartialHazard Each subject's hazard relative to one at the means.
CoxSummary.PredictPercentile The time each subject's survival falls to a level.
CoxSummary.PredictSurvivalFunction Each subject's survival at given times.