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.
Kaplan-Meier · S(t)
Probability of remaining active at a given horizon despite censoring.
Log-rank
Global comparison of curves, without covariate adjustment.
Cox · HR
Relative conditional instantaneous hazard; neither an individual probability nor a causal effect here.
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.
- 01
Origin
Subscription starts and baseline engagement is observed.
- 02
Event
Churn is observed; churn_event equals 1.
- 03
Censoring
The customer is still active at the end; churn_event equals 0 and observed time remains informative.
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.
Treating an active customer as if churn had already occurred, or excluding that customer from the calculation.
05
Intuition
Kaplan-Meier
Ŝ(t)=∏(1-dᵢ/nᵢ)Estimates survival at each horizon while retaining partial information from censored records.
Log-rank
H₀: Sₘ(t)=Sₐ(t)Compares the two curves globally without adjusting for baseline engagement.
Cox
h(t|x)=h₀(t)exp(xβ)Estimates a conditional relative hazard when proportionality is sufficiently plausible.
Kaplan & Meier (1958), Nonparametric Estimation from Incomplete Observations · Cox (1972), Regression Models and Life-Tables
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
Survival
S(t)=Pr(T>t)Ŝ(t)=∏₍ₜᵢ≤ₜ₎(1-dᵢ/nᵢ)Conditional hazard
h(t|x)=h₀(t)exp(β₁ annual + β₂ engagement)HR=exp(β₁)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
- 01
Population, origin, event and censoring are declared before calculation.
- 02
Ŝ(t) and its pointwise 95% interval using Greenwood variance on the log-log scale are computed by group.
- 03
Cox's two-sample score, equivalent here to log-rank, compares curves; Cox then adjusts for group and engagement.
- 04
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
Reproducible synthetic example · 600 customers · 401 churns · 199 censored
S(9)
Monthly 0.489
Annual 0.779
S(12)
Monthly 0.380
Annual 0.702
S(18)
Monthly 0.255
Annual 0.534
Cox · HR
0.494
95% CI [0.397, 0.615]At 12 months, the 95% intervals are [0.328, 0.432] and [0.642, 0.754]. 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
What the interval quantifies
Pointwise uncertainty around Ŝ(t) and asymptotic uncertainty around the HR in the declared specification.
What it does not cover
Simultaneous bands, selection bias, measurement error and 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
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
- 01
Choose the monitoring horizons that are genuinely useful to the decision.
- 02
Study plan selection qualitatively before interpreting the association.
- 03
Decide whether a causal test of switching to annual is needed.
16
When to change method
Competing risks
When several exits are mutually exclusive.
Multi-state
For repeated transitions between states.
Time-varying covariates
When exposure changes during follow-up.
Causal design
If the decision concerns the effect of an intervention.
17
Implementations
Executable references
Standard-library Python 3.13 is the executable reference. R 4.5.1 with survival 3.8-3 is a companion reference.
Secondary syntaxes
SPSS 31 and SAS 9.4 must be verified in their environment.
SPSS 31
COMPUTE annual=(plan_group="annual").
EXECUTE.
KM duration_months BY annual
/STATUS=churn_event(1).
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;
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
- 01
Population, origin, event, window and censoring rule.
- 02
Risk table, Ŝ(t) curves, S(12)/S(18), medians and intervals.
- 03
Cox specification, HR with interval, PH diagnostic, limitations and supported/forbidden decision.
19
Scientific sources
Three publications ground the calculations shown. Each addresses a precise methodological question, and none establishes commercial performance or a causal plan effect.
- Kaplan & Meier (1958), Nonparametric Estimation from Incomplete ObservationsProduct-limit estimator and censoring
Grounds estimation of S(t) when some durations are censored. It does not establish any causal difference between plans.
- Cox (1972), Regression Models and Life-TablesProportional hazards and comparison score
Grounds the Cox model, the conditional hazard ratio and the declared time diagnostic. The HR remains relative and associative in this example.
- Zhang, Solomon & Sizemore (2022), Inferences for current chronic GVHD-free and relapse-free survivalSurvival interval on the log-log scale
Supports construction of the pointwise interval shown around S(t). This interval covers neither selection bias nor transport to another population.
Dataset · Tool
Method connections
