Survival aalensummary - 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
AalenSummary
What an Aalen additive fit reports, at lifelines parity, and the predictions it makes.
public sealed class AalenSummary
Properties — the per-time lists are row-major, one row per event time and one column per coefficient: the covariates in the design's order, then the intercept.
EventTimesare the distinct event times the coefficients step at, ascending: lifelines' index, cut where the fit stopped.CovariateIndicessays which design column each coefficient multiplies,-1for the intercept.Hazardsare each coefficient's increment at each event time, lifelines'hazards_.CumulativeHazardsare the increments summed, lifelines'cumulative_hazards_.CumulativeVarianceis their variance, lifelines'cumulative_variance_.ConfidenceLowerandConfidenceUpperare each cumulative coefficient's normal interval atConfidenceLevel.
For the model, one value per coefficient or one in all:
Slopesare each cumulative coefficient's slope through the origin, weighted by the number at risk, lifelines'summary["slope(coef)"], andSlopeStandardErrorstheir standard errors.ConcordanceIndexis Harrell's C, lifelines'concordance_index_.ConfidenceLevelis the level the intervals were built at,FeatureCountthe number of covariates a design row holds, andFitInterceptwhether the fit carries an intercept, the last coefficient.
Example — the fit of the AalenAdditive page: the treatment, then the
intercept, over ten event times.
using Lodestar.Survival;
double[] treated = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1];
double[] months = [3, 10, 5, 4, 8, 18, 12, 6, 9, 20, 7, 15];
bool[] died = [true, true, true, false, true, true, true, true, true, false, true, true];
AalenSummary fit = AalenAdditive.Fit(treated, months, died, featureCount: 1);
int times = fit.EventTimes.Count; // => 10
int intercept = fit.CovariateIndices[1]; // => -1
double treatment = Math.Round(fit.CumulativeHazards[18], 6); // => -2.083333
double lower = Math.Round(fit.ConfidenceLower[18], 6); // => -3.851921
double slopeError = fit.SlopeStandardErrors[0]; // => 0.113183…
Remarks — a cumulative coefficient is read by its slope, not its level. Its value at a time
is the effect summed up to then; where it runs straight the covariate adds a constant amount to the
hazard, where it bends the effect changed. Slopes sums that up in one number, and
SmoothedHazards gives the slope time by time.
lifelines' readings are kept on purpose, so the numbers are lifelines':
CumulativeVarianceis rescaled by the covariate's deviation, not its square. The fit runs on covariates scaled to unit deviation, and lifelines divides the variance back by the deviation once, as it does the coefficients; the bounds are built on it.ConcordanceIndexpairs the durations sorted by lifelines with the predictions in the design's order. lifelines scores the training subjects that way, so the index is not Harrell's C of the fit unless the design came sorted by duration. With tied durations, lifelines' own pairing follows numpy's unstable sort, which varies with the CPU; this one sorts stably.
A class rather than a record, as CoxSummary is: it carries the fitted model its
predictions evaluate.
Applies to — net10.0, netstandard2.0.
See also — AalenAdditive.Fit, AalenOptions.
Members
| Member | What it does |
|---|---|
AalenSummary.PredictCumulativeHazard |
Each subject's cumulative hazard at every event time. |
AalenSummary.PredictExpectation |
Each subject's expected lifetime, over the event times. |
AalenSummary.PredictMedian |
Each subject's median survival time. |
AalenSummary.PredictPercentile |
The event time at which each subject's survival reaches a level. |
AalenSummary.PredictSurvivalFunction |
Each subject's survival at every event time. |
AalenSummary.SmoothedHazards |
The increments smoothed by an Epanechnikov kernel. |