ds@mcpanalytics.aiEmail your data and your question and get an answer about your own data, with the method shown.Email your data and question. Get an answer.
How long until something happened: which analyses fit this data | MCP Analytics
Data shape

How long until something happened

By MCP Analytics Team | Published , updated

One row per customer is a different problem from one row per customer per month. The shape of the file narrows which methods can apply to it.

See a worked example

How the analyses here work

How long until something happened: prebuilt analyses

The analyses filed under this data shape. Each card opens the analysis page, where you can run it on a file.

Worked example

How long does a typical customer stay before cancelling?

The data. standard_survival_v2.csv, the published sample file for Survival analysis: 600 rows; columns customer_id, plan, months_active, churned, signup_region. Sample data, not a customer's.

The calculation. Python, standard library only. This exact code ran against the file when this page was built, and printed the output below it.

import csv
rows = list(csv.DictReader(open("standard_survival_v2.csv")))
data = [(float(r["months_active"]), int(r["churned"])) for r in rows]
at_risk, s, median = len(data), 1.0, None
for t in sorted({t for t, _ in data}):
    ended = sum(1 for u, e in data if u == t and e == 1)
    s *= 1 - ended / at_risk  # Kaplan-Meier step
    if median is None and s <= 0.5:
        median = t
    at_risk -= sum(1 for u, _ in data if u == t)
churned = [u for u, e in data if e == 1]
print(len(data), "customers,", len(churned), "churned,",
      len(data) - len(churned), "still active")
print("Kaplan-Meier median months to churn:", median)
print("naive mean over churners only:",
      round(sum(churned) / len(churned), 1))
600 customers, 433 churned, 167 still active
Kaplan-Meier median months to churn: 18.22
naive mean over churners only: 14.1

What it says. Half of customers are estimated to have churned by month 18.22. Averaging only the customers who already left gives 14.1 months, which is too short: it ignores the 167 who are still active and have already lasted that long. Kaplan-Meier counts them for as long as they were watched.

What it does not say. The median assumes customers still active are as likely to leave later as similar customers who left. It describes this file only; the library analysis compares plans with a Cox model and checks that its proportional-hazards assumption holds.

Run Survival analysis on this file or your own, or open its stored sample report.

Sources

Further reading on the method in the worked example. Each reference was looked up and its authors, title, year and venue confirmed on 27 October 2026.

  1. Kaplan E, Meier P (1958). Nonparametric Estimation from Incomplete Observations. Journal of the American Statistical Association. https://doi.org/10.1080/01621459.1958.10501452
  2. Cox D (1972). Regression Models and Life-Tables. Journal of the Royal Statistical Society Series B: Statistical Methodology. https://doi.org/10.1111/j.2517-6161.1972.tb00899.x
  3. Grambsch P, Therneau T (1994). Proportional hazards tests and diagnostics based on weighted residuals. Biometrika. https://doi.org/10.1093/biomet/81.3.515

By MCP Analytics Team. Updated November 2026. Analysis list from the library catalog.

A delivered report from this list

Survival analysis: sample report Open full report →

The stored sample report for Survival analysis. Each analysis has its own report layout; open its page to see what it returns.