OpenBI Docs Buy

SURVIVAL.SUMMARY OpenBI

A survival curve's median and expected lifetime to a horizon.

Group: Survival analysis. OpenBI’s own: DAX has no function of this name.

Syntax

SURVIVAL.SUMMARY ( <table>, <duration>, <event> [, <group>] [, <horizon>] )
ParameterTypeDescription
tableTableThe rows to follow, one a subject such as a customer, a policy or a machine: a table of the model or a table expression, as the filters leave it.
durationNumber
evaluated for each row
How long each row was followed: until its event, or until we stopped seeing it. In any unit (days, months, years), the same for every row.
eventNumber
evaluated for each row
1 or TRUE when the row's duration ended in the event (the customer left); 0 or FALSE when it did not, so all we know is that it lasted at least that long (censored).
groupExpression
optional, evaluated for each row
Splits the rows into groups, such as plans or regions, each with its own result. Left out, all the rows are one group.
horizonNumber
optional
The time the restricted mean runs to. Left out, the longest duration of all the rows, the same for every group.

Returns

Table. A row a group. The columns: Group (when grouped); Observations and Events; Median, Median lower and Median upper; Restricted mean and its Std error; Horizon and Survival at horizon.

Remarks

  • Median is the earliest time at which the Kaplan-Meier curve has fallen to a half or lower (midway to the next drop when it sits at exactly a half); blank when the curve never gets that low.
  • Median lower and Median upper are where the curve's 95 % bounds reach a half: an interval for the median, blank when a bound never gets there.
  • Restricted mean is how long a row lasts on average up to the horizon, such as a customer's expected months in the first year: the area under the curve between 0 and the horizon. It is a fair figure even when many rows are censored.
  • Survival at horizon is the curve's value there.
  • Rows with a blank duration or a blank event are left out. An event other than 0, 1, TRUE or FALSE is an error.
  • The groups come in sorted order; rows whose group is blank are left out.

Compared with DAX

An OpenBI function: DAX has none like it, so a measure or query that uses it works in OpenBI only, not in Power BI or Analysis Services.

Examples

Two plans side by side

Both lose three of five, but Plus customers stay longer: their curve stays higher, so its area to month 15 is larger.

EVALUATE
VAR Customers =
    DATATABLE (
        "Plan", STRING, "Months", INTEGER, "Left", INTEGER,
        {
            { "Basic", 2, 1 }, { "Basic", 3, 0 }, { "Basic", 5, 1 }, { "Basic", 7, 1 }, { "Basic", 8, 0 },
            { "Plus", 4, 1 }, { "Plus", 9, 0 }, { "Plus", 11, 1 }, { "Plus", 12, 1 }, { "Plus", 15, 0 }
        }
    )
RETURN
    SELECTCOLUMNS (
        SURVIVAL.SUMMARY ( Customers, [Months], [Left], [Plan] ),
        "Group", [Group],
        "Observations", [Observations],
        "Events", [Events],
        "Median", [Median],
        "Restricted mean", [Restricted mean],
        "Std error", [Std error],
        "Survival at horizon", [Survival at horizon]
    )
GroupObservationsEventsMedianRestricted meanStd errorSurvival at horizon
Basic5377.62.355890961445840.266666666666667
Plus531210.93333333333331.737772094335690.266666666666667

The first year

Within the first 12 months a customer stays 8.6 months on average.

EVALUATE
VAR Customers =
    DATATABLE (
        "Plan", STRING, "Months", INTEGER, "Left", INTEGER,
        {
            { "Basic", 2, 1 }, { "Basic", 3, 0 }, { "Basic", 5, 1 }, { "Basic", 7, 1 }, { "Basic", 8, 0 },
            { "Plus", 4, 1 }, { "Plus", 9, 0 }, { "Plus", 11, 1 }, { "Plus", 12, 1 }, { "Plus", 15, 0 }
        }
    )
RETURN
    SELECTCOLUMNS (
        SURVIVAL.SUMMARY ( Customers, [Months], [Left], , 12 ),
        "Observations", [Observations],
        "Events", [Events],
        "Median", [Median],
        "Median lower", [Median lower],
        "Restricted mean", [Restricted mean],
        "Horizon", [Horizon],
        "Survival at horizon", [Survival at horizon]
    )
ObservationsEventsMedianMedian lowerRestricted meanHorizonSurvival at horizon
1061158.5625120.1875

SURVIVAL.CURVE, SURVIVAL.MEDIAN, SURVIVAL.AT, SURVIVAL.TEST.

Last updated · OpenBI Studio 0.3.74