How do you analyze retention with a survival model?
Survival analysis represents time to churn while handling censoring. Kaplan-Meier describes survival; the Cox model links covariates to hazard under proportional hazards.
Direct answer
Compare retention curves and estimate associations with instantaneous risk.
Survival analysis represents time to churn while handling censoring. Kaplan-Meier describes survival; the Cox model links covariates to hazard under proportional hazards.
01
The answer in 30 seconds
Use Kaplan-Meier to estimate the probability of remaining active under censoring. Use Cox to compare conditional hazards under proportional hazards. A hazard ratio remains relative, associative here, and does not give an individual probability.
02
Marketing situation
A team observes customers from different dates. Some churn, while others are still active when observation ends. Comparing only churn percentages removes time and wrongly treats censored records as complete.
03
Scientific question
In the declared population and window, what is S(t), the probability of remaining active beyond t months, and what conditional association links plan group to the instantaneous hazard?
04
Why the crude rate fails
Twelve-month retention computed only on complete records favours older cohorts. Mean observed duration understates customers still active. Survival analysis explicitly retains the partial information supplied by their observed time.
05
Intuition
Kaplan-Meier multiplies conditional probabilities of passing each event time. Cox compares hazards at given covariates without imposing the baseline-hazard shape. Censoring reduces the risk set without creating churn.
06
Required data
Analysis population: the 600 synthetic customers whose subscription starts in the 90-day recruitment window, with positive duration and observed plan group, churn status and baseline engagement. One row per customer is included. Any missing or invalid required input stops the analysis and reports the affected row count; no imputation or implicit category is allowed. duration_months is the analytical duration; dates are calendar markers rounded to the day.
| Field | Definition |
|---|---|
customer_id | Unique identifier |
start_date / end_date | Observed origin and end |
duration_months | Positive time from origin |
churn_event | 1 observed churn, 0 censored |
plan_group | Monthly or annual group |
baseline_engagement_z | Baseline engagement on an N(0,1) scale |
07
Models and symbols
S(t)=Pr(T>t); Ŝ(t)=∏₍ₜᵢ≤ₜ₎(1-dᵢ/nᵢ)h(t|x)=h₀(t)exp(β₁ annual + β₂ engagement)T is time to churn in months; t is the month horizon; dᵢ and nᵢ are churns and the risk set at tᵢ. S(t) and Ŝ(t) are unitless probabilities. h(t|x) and h₀(t) are instantaneous monthly hazards conditional on covariates x. annual equals 1 for annual and 0 for monthly; engagement is baseline_engagement_z on the N(0,1) scale. β₁ and β₂ are log-hazard coefficients; exp(β₁) is the unitless annual-versus-monthly hazard ratio at equal engagement.
Kaplan & Meier (1958), Nonparametric Estimation from Incomplete Observations · Cox (1972), Regression Models and Life-Tables
08
Reproducible calculation
- Population, origin, event and censoring are declared before calculation.
- Ŝ(t) and its pointwise 95% interval using Greenwood variance on the log-log scale are computed by group.
- Cox's two-sample score, equivalent here to log-rank, compares curves; Cox then adjusts for group and engagement.
- A group × log(t/12) interaction diagnoses declared proportionality.
Kaplan & Meier (1958), Nonparametric Estimation from Incomplete Observations · Cox (1972), Regression Models and Life-Tables · Zhang, Solomon & Sizemore (2022), Inferences for current chronic GVHD-free and relapse-free survival
09
Numerical example
Synthetic dataset of 600 customers: 401 churns and 199 censored observations. Horizon sensitivity gives Ŝ(9)=0.489, Ŝ(12)=0.380 and Ŝ(18)=0.255 for monthly, versus 0.779, 0.702 and 0.534 for annual. At 12 months, the 95% intervals are [0.328, 0.432] and [0.642, 0.754]. Adjusted Cox gives HR=0.494 [0.397, 0.615]. The time interaction is γ=0.179, p=0.082. These values describe only this synthetic process.
10
Operational assumptions
- Are event and time origin identical for everyone?
- Conditional on observed covariates, does censoring inform future churn?
- Is the hazard ratio stable over the horizon?
- Does another event prevent observing churn?
- Are conclusions coherent at the prespecified 9-, 12- and 18-month horizons and with the declared time interaction?
Kaplan & Meier (1958), Nonparametric Estimation from Incomplete Observations · Cox (1972), Regression Models and Life-Tables
11
Diagnostics
Censoring
199/600 observations are censored; reason and timing are published.
Proportionality
Group × log(t/12) interaction: γ=0.179, p=0.082; failure to reject does not prove the assumption.
Support
Annual median 19.590 months; no extrapolation beyond 24 months.
12
Uncertainty
Pointwise 95% intervals for Ŝ(t) use Greenwood on the log-log scale; the HR interval uses asymptotic observed information. They are not simultaneous bands and cover neither selection bias, measurement error nor post-hoc horizon choice.
Kaplan & Meier (1958), Nonparametric Estimation from Incomplete Observations · Zhang, Solomon & Sizemore (2022), Inferences for current chronic GVHD-free and relapse-free survival
13
Interpretation
HR=0.494 means that, in this synthetic dataset at equal baseline engagement, the estimated instantaneous hazard for the annual group is about 49% of the monthly group's. It does not mean 50.6 retention points more and does not give individual risk.
14
Supported and forbidden conclusions
Supported
Estimate S(12), compare curves and describe a conditional association in the declared population, window and specification.
Forbidden
Present annual plans as causing retention, convert the HR into an individual probability, ignore competing risks or extrapolate beyond 24 months.
15
Possible marketing decision
The team can choose monitoring horizons, scope qualitative research into plan selection, and decide whether a causal test of switching to annual is needed. The model alone prescribes no commercial change.
16
When to change method
Use competing-risks methods when exits are mutually exclusive, a multi-state model for repeated transitions, time-varying covariates when exposure evolves, or a causal design when the decision concerns an intervention effect.
17
Implementations
Standard-library Python 3.13 is the executable reference. R 4.5.1 with survival 3.8-3 is a companion reference. SPSS 31 and SAS 9.4 are secondary syntaxes to verify in their environment.
CSV · Python 3.13 · R 4.5.1
SPSS 31: COMPUTE annual=(plan_group="annual").
SPSS 31: EXECUTE.
SPSS 31: KM duration_months BY annual /STATUS=churn_event(1).
SPSS 31: COXREG duration_months /STATUS=churn_event(1) /METHOD=ENTER annual baseline_engagement_z.
SAS 9.4: proc lifetest data=input; time duration_months*churn_event(0); strata plan_group; run;
SAS 9.4: proc phreg data=input; class plan_group(ref='monthly') / param=ref; model duration_months*churn_event(0)=plan_group baseline_engagement_z / ties=breslow; run;18
Expected deliverable
- Population, origin, event, window and censoring rule.
- Risk table, Ŝ(t) curves, S(12)/S(18), medians and intervals.
- Cox specification, HR with interval, PH diagnostic, limitations and supported/forbidden decision.
19
Scientific sources
E3 evidence: two foundational full texts verified at claim level. They ground product-limit estimation, censoring, the Cox model and the time diagnostic. They prove no commercial performance.
Dataset · Tool
Method connections
