Survival analysis, churn and customer lifetime value

A churn model that outputs a probability of leaving answers the wrong question. Every customer leaves eventually; what you need to know is when, and what the time before that is worth. Survival analysis gives you both. In this chapter I take Werkbank, my example Rails SaaS for craft businesses with 2,400 accounts, and walk through the survival and hazard functions, Kaplan Meier curves by plan, a Cox proportional hazards model with hazard ratios you can actually read (completed onboarding cuts the churn hazard to 0.55, each extra seat takes off another 12%), and how the shape of the hazard over time tells you exactly when to phone people. Then the money: the difference between descriptive lifetime value (what customers have been worth, about €1,100 here) and predictive lifetime value (margin times survival times a discount factor, summed, about €1,900), why the gap is not optimism, how contractual and non contractual churn differ, and what a proper LTV does to what you can afford to pay for a customer. The numbers are illustrative; the method is the one I use. This is part 8 of 21 of the Marketing Analytics series.

The account that was already gone

Werkbank, the Rails SaaS for craft businesses I use as an example in this series, has about 2,400 paying accounts. One Tuesday the founder sent me a spreadsheet titled "churn model". Someone had built a logistic regression on last year's data, and for every account it gave a probability of cancelling. A roofing firm in Wels sat at 0.81. The team wrote to them, offered a call, offered a discount. The roofer had cancelled eleven days earlier. The model was right and completely useless, because it answered the wrong question. It said whether. Nobody had asked when.

That is the gap this chapter fills. A yes or no churn model treats every customer as if they stand at the same point in their life with you. A joinery that signed up last week and a plumber in month 31 are different animals, and the interesting thing about both is not whether they will ever leave (everyone does, eventually) but how long they are likely to stay and what that time is worth. Survival analysis answers exactly that, and with the time dimension in hand, customer lifetime value stops being a slogan and becomes a number you can defend in front of an accountant.

Where this sits in the series

This is chapter eight, in part two of the series, the dependent variable techniques of chapters 4 to 10. In the previous chapter, Logistic regression, lift charts and market basket analysis, the dependent variable was a yes or a no. Here it is a duration, with the twist that for most customers the duration is not finished yet. In the next chapter, Panel regression and same store sales, it becomes a series of numbers observed over time for many units at once.

Why time to event beats yes or no

Three reasons. First, timing. If churn risk peaks in month three and again at the annual renewal, you want your retention effort in month two and month eleven, not spread evenly. A survival model draws the risk over time and you read the peaks off it.

Second, censoring. Most of Werkbank's 2,400 accounts are still customers. A yes or no model labels them "did not churn", which is a lie: they have not churned yet. An account that joined in January and is still active in June has told you it survived six months and nothing about month seven. Survival analysis calls this censoring and uses those six months honestly instead of throwing the account away or pretending it is loyal. Mislabelling half your data is how you get a model that is confidently wrong.

Third, value. Once you know the probability that an account is still paying in month 18, you multiply it by the margin you earn in month 18, discount it back to today and add it all up. That is a lifetime value with a foundation, not "average revenue divided by average churn rate", which assumes churn is constant over time, and it is not.

The numbers in this article are illustrative; Werkbank is fictional. The curve shapes and effect sizes are what I typically see in subscription businesses of this size.

The two functions that do all the work

Survival analysis rests on two functions of time. The survival function is the probability that a customer is still with you after time tt:

S(t)=P(T>t)S(t) = P(T > t)

TT is the random variable "how long this customer lasts" and tt a specific point in time, say twelve months. S(0)S(0) is one and S(t)S(t) only ever goes down. If S(12)=0.69S(12) = 0.69 for Werkbank's Team plan, 69% of new Team accounts are still paying a year after signing up.

The hazard function is the instantaneous rate of leaving at time tt among the customers who have made it that far:

h(t)=lim⁡Δt→0P(t≤T<t+Δt∣T≥t)Δth(t) = \lim_{\Delta t \to 0} \frac{P(t \le T < t + \Delta t \mid T \ge t)}{\Delta t}

In words: take the customers still alive just before tt, look at the share who leave in the next small slice of time Δt\Delta t, and divide by the width of that slice. With monthly data, the hazard in month three is simply the accounts that cancelled in month three divided by the accounts still active at the start of it. The hazard is the function for decisions, because it tells you where the risk lives. The survival function is the one for money, because it tells you how many customers you will have left. They are two views of the same thing:

S(t)=exp⁡(−∫0th(u) du)S(t) = \exp\left(-\int_0^t h(u)\,du\right)

Survival to tt is the exponential of minus the total hazard accumulated between zero and tt. With monthly data the integral becomes a product over earlier months of one minus that month's hazard. Know one function and you know the other.

Kaplan Meier: the honest curve

Before any modelling I draw a Kaplan Meier curve, the non parametric estimate of S(t)S(t), which handles censoring without any assumption about the shape of the curve:

S^(t)=∏ti≤t(1−dini)\hat{S}(t) = \prod_{t_i \le t} \left(1 - \frac{d_i}{n_i}\right)

For each month tit_i up to tt, did_i is the number of accounts that cancelled in that month and nin_i the number still at risk at its start, meaning active and not yet censored. Each factor is the probability of surviving that month given that you reached it; the product chains them. A censored account counts in nin_i for every month it was observed and then drops out of the denominator, contributing what it knows and nothing more.

For Werkbank I split the curve by plan. Starter is €29 a month and mostly sole traders; Team is €89 a month with several seats.

Two Kaplan Meier curves over 24 months, Team plan on top, Starter below. The gap opens in the first four months and then stays roughly parallel.

Reading it: after twelve months 69% of Team accounts are still active against 54% of Starter accounts; after two years 59% versus 42%. The steep part of both curves is the first four months, then a slow decline with a step at month twelve, the annual renewal. The curve is descriptive, and already worth having: the founder had been reporting a single "monthly churn of 2.1%" to his board, true as an average and hiding that a brand new Starter account was leaving at three times that rate.

The hazard view of the same Team plan data makes the timing point sharper.

Monthly hazard for the Team plan. Risk peaks in months two to four, drops to under 2% by month nine and jumps again at the annual renewal.

If you want to know when to intervene, this is the chart. Months two to four are where accounts are lost: after the trial has converted, before the business has moved its real quoting and invoicing into the tool. Whatever you do about churn, do it in weeks two to eight. The month twelve bump is a smaller problem with a separate fix: a renewal conversation in month ten or eleven, not an automated "your card will be charged" email on the day.

The Cox model: what moves the hazard

Kaplan Meier gives you the curve per group. It cannot tell you whether the Team plan survives better because of the plan itself or because Team accounts have more seats and more of them finished onboarding. For that you need a regression on the hazard, and the workhorse is the Cox proportional hazards model:

h(t∣x)=h0(t) exp⁡(β1x1+β2x2+⋯+βkxk)h(t \mid x) = h_0(t)\,\exp(\beta_1 x_1 + \beta_2 x_2 + \dots + \beta_k x_k)

h(t∣x)h(t \mid x) is the hazard at time tt for a customer with characteristics x1x_1 to xkx_k. h0(t)h_0(t) is the baseline hazard, the risk over time for a reference customer with every xx at zero, and the model never needs to know its shape, which is the clever part. The exponential term scales that baseline up or down per customer, with the β\beta coefficients estimated from the data. Because the effect is multiplicative and does not depend on tt, the ratio of hazards between two customers is constant over time. That is the proportional hazards assumption, and it is an assumption, not a fact; I come back to it under pitfalls.

The quantity you read is exp⁡(βj)\exp(\beta_j), the hazard ratio. A hazard ratio of 0.55 means that, holding everything else fixed, a customer with that characteristic has 55% of the churn risk of one without it at every point in time, a 45% lower risk. Above one means higher risk; exactly one means the variable does nothing.

Here is the Werkbank model, fitted on all 2,400 accounts, of which 1,060 have churned and 1,340 are censored, with a concordance of 0.71 (for a random pair of accounts, the model says correctly which one lasts longer 71% of the time).

VariableCoefficientHazard ratio95% intervalPlain reading
Onboarding completed (yes versus no)minus 0.600.550.47 to 0.6445% lower risk at every point in time
Seats (per additional seat)minus 0.130.880.84 to 0.92each extra seat cuts the risk by 12%
Team plan versus Starterminus 0.340.710.61 to 0.8329% lower risk in any given month
Annual billing versus monthlyminus 0.480.620.51 to 0.7538% lower risk
Acquired via paid search versus referral0.221.241.05 to 1.4724% higher risk
Support tickets in the first 30 days (per ticket)0.091.091.01 to 1.189% more risk per ticket

Line by line. Onboarding completion is the biggest lever: an account that finished the three onboarding steps (imported customers, sent one quote, connected a bank feed) has a hazard ratio of 0.55, with an interval from 0.47 to 0.64 that stays well below one, so I believe the direction and roughly the size. Each additional seat cuts the hazard by another 12%: a tool three people use daily is harder to leave than one person's experiment. With those two in the model the plan effect shrinks to 0.71; part of the raw Team advantage in the Kaplan Meier curve was really onboarding and seats. Annual billing at 0.62 is partly commitment and partly selection, because businesses that pay annually were already the confident ones. Paid search accounts leave 24% faster than referrals, which feeds into the acquisition maths later. And each support ticket in the first month adds 9%, not because support is bad, but because early tickets are a symptom of a bad fit.

Because the effects multiply, you can combine them. A Team account, paying annually, onboarded, with four seats (three more than the baseline) has a hazard of 0.71×0.62×0.55×0.8830.71 \times 0.62 \times 0.55 \times 0.88^3 relative to the baseline, about 0.165: one sixth of the churn risk of a monthly Starter account that never finished onboarding. Nobody needs to phone the first one in month two. Everybody needs to phone the second.

Deciding when to intervene

The model earns its keep when you use both outputs together: the hazard shape from Kaplan Meier tells you when, the hazard ratios from Cox tell you whom. For Werkbank that produced three rules.

Accounts that have not completed onboarding by day 14 get a human, not a drip campaign. Onboarding halves the hazard, and 61% of accounts that finish it do so in the first two weeks, almost none after week six. Weeks two to six are the window where a phone call can change the outcome.

Monthly Starter accounts with one seat get a targeted seat offer in month two. Each seat is worth 12% of hazard, and a second seat added early is the least expensive retention intervention Werkbank has, because it also raises revenue.

Annual accounts get a renewal conversation in month ten. Not a discount, a conversation about what they used and what would make next year better. The month twelve spike is largely accounts that were never asked.

The model does not prove that phoning people works. It identifies who is at risk and when, which lets you design a test. The mechanics of onboarding that forms habits are in Onboarding and habit formation; the survival model tells you the size of the prize if you get it right.

Lifetime value: descriptive versus predictive

Now the money. Two different things get called customer lifetime value, and they answer different questions.

Descriptive LTV asks what customers have been worth. Take every account, add up the margin it has produced to date, average. For Werkbank's Team plan that is about €1,100 per account: the average account is about 15.5 months old (churned and active mixed together) and produces €71 of contribution margin a month on an €89 price after hosting, payment fees and support. Useful for a finance conversation about the past. Terrible as a basis for acquisition spend, because it is dragged down by every account that is three months old with years of paying ahead of it, and a growing business has more young accounts than old ones.

Predictive LTV asks what a customer signing up today will be worth over their life with you. That is where the survival function comes in:

LTV=∑t=1Tmt S(t)(1+r)tLTV = \sum_{t=1}^{T} \frac{m_t \, S(t)}{(1 + r)^t}

For each future month tt up to a horizon TT, mtm_t is the margin you earn if the customer is still there, S(t)S(t) the probability that they are, and (1+r)t(1 + r)^t discounts that expected margin back to today at a monthly rate rr. Margin times survival is the expected margin in that month; the discount says a euro in month 48 is worth less than a euro now, because of the cost of money and because a lot can go wrong in four years. The sum over months is the value.

Here is the calculation for a Team account: the model's monthly hazard for the Team plan, €71 monthly margin, a 1% monthly discount rate (roughly 12.7% a year, deliberately conservative for a small company) and a 60 month horizon. Selected months shown; the real table has sixty rows.

MonthHazard in that monthSurvival S(t)Discount factorExpected discounted margin (€)Cumulative LTV (€)
13.5%0.9650.99067.8468
35.1%0.8720.97160.08192
62.6%0.7870.94252.62356
123.0%0.6930.88743.64640
242.2%0.5930.78833.161,095
362.2%0.5080.69925.201,441
482.2%0.4350.62019.151,703
602.2%0.3720.55014.561,903

Walk down it. In month one 96.5% of accounts are still there and you expect €67.84 of the €71 margin. By month three the hazard has peaked at 5.1%, survival is 0.872 and you bank €60. Month twelve shows the renewal spike in the hazard column, survival at 0.693 and €43.64 of expected discounted margin. From then on the hazard is a steady 1.2% with 2.2% bumps at each anniversary, and the discounted margin drifts down to €14.56 in month sixty. The cumulative column is the answer: about €1,903 per new Team account, which I round to €1,900. That is 73% more than the descriptive €1,100, and the difference is not optimism, it is the years of margin the young accounts in the descriptive average have not yet had time to produce.

Stopping at 60 months leaves value on the table (there is still a 37% chance the account is paying at month sixty) and I am fine with that; five years is as far as I trust any subscription model. The choice of rr is a business decision, not a statistical one: ask the person who signs off the budget what return they need on money tied up for a year.

Contractual and non contractual churn

Everything above assumes you know when a customer left. Werkbank does: a subscription is cancelled on a date, the event is observed. That is contractual churn, the easy case.

The Gift Bow, my hamper shop, has the hard case. A customer who bought a Christmas hamper in 2024 and nothing since has not cancelled anything. She might buy again this December or be gone for good. You never observe the death, only silence, and silence in a seasonal business is not evidence of much. This is non contractual churn and the tools above need adapting. Either you define an operational death (no purchase within 18 months counts as churned, and you accept some error), or you use probabilistic purchase timing models where "alive" is a latent state inferred from how recently and how often someone bought. The second is better and more work. For a shop with a few thousand customers I start with the operational definition and check it against the buyers who came back after a long gap. The retention arithmetic under both cases is in The retention maths.

What LTV changes about acquisition

The founder's most expensive habit was bidding on Google Ads to a cost per acquisition target of €250, chosen because it "felt right". A Team account is worth about €1,900 in discounted margin, so €250 is trivially fine. But paid search accounts carry a hazard ratio of 1.24. Run the LTV sum again with every month's hazard multiplied by 1.24 and a paid search Team account drops to roughly €1,650; still well above €250, but a Starter account from paid search that never onboards is worth under €500, and Werkbank was paying the same €250 for both.

So the LTV work changed two things. The allowable acquisition cost became a per segment number: about €550 for a Team lead (a third of predicted LTV, the ratio the founder chose after seeing the payback period) and €150 for a Starter lead. And the campaign optimisation target moved from "trial started" to "onboarding completed", because onboarding is the moment a lead becomes worth something. The bidding side is in Bid on lifetime value, not cost per click; the survival model is where the lifetime value in that headline comes from.

How to run it yourself

You need one row per customer with three things: how long they were observed (months from signup to cancellation, or to today if still active), whether the observation ended in churn (1) or is censored (0), and the covariates that matter, measured near the start so you are not using the future to predict the past. Seat count at day 30 is fine. Seat count at cancellation is cheating.

For Werkbank the dataset is one SQL query against the subscriptions and events tables, and the modelling fits in a page of Python with the lifelines library:

from lifelines import KaplanMeierFitter, CoxPHFitter

km = KaplanMeierFitter()
for plan, grp in accounts.groupby("plan"):
    km.fit(grp["months"], event_observed=grp["churned"], label=plan)
    print(plan, km.survival_function_at_times([6, 12, 24]).round(3).tolist())

cox = CoxPHFitter()
cox.fit(accounts[["months", "churned", "onboarded", "seats",
                  "plan_team", "annual", "paid_search", "tickets_30d"]],
        duration_col="months", event_col="churned")
cox.print_summary(decimals=2)
cox.check_assumptions(accounts, p_value_threshold=0.05)

Timing: extraction and cleaning take a day or two if the subscription history is sane, a week if it has been through two billing systems. Kaplan Meier takes an hour, a defensible Cox model two or three days including assumption checks, and the LTV table is a spreadsheet exercise once you have the curve. Call it two weeks from clean data to a decision memo.

Checks before you trust it: plot the Kaplan Meier curve per group and per cohort year and look for curves that cross, a sign that proportional hazards is broken for that variable, then run the library's formal test. Hold out the most recent cohort and check that predicted twelve month survival matches what happened. Be suspicious of a concordance above 0.85, which usually means a variable is leaking the outcome. And read the hazard ratios to someone who runs the business; if one makes no sense to them, it is more often the data than their intuition that is wrong.

Pitfalls

Proportional hazards is an assumption. The Cox model says the effect of annual billing is the same multiplier in month two as in month twenty. Often it is not: annual billing has almost no effect in month two (nobody cancels a plan they just paid a year for) and a large one at month twelve. When the Kaplan Meier curves for two groups cross or converge, the single hazard ratio averages something that is not constant. The fixes are to stratify on that variable or let its effect vary with time. Both are standard, neither is automatic.

Leakage through covariates measured too late. "Logins in the last month" predicts churn beautifully because accounts about to cancel stop logging in. It is a symptom, not a predictor, and a model built on it will be very accurate and completely unactionable. Measure covariates at a fixed early point.

Treating LTV as a single number. The €1,900 hides a €500 segment and a €3,000 segment. A single company wide LTV used for bidding overpays for the weak segment and underpays for the strong one, which is exactly where Werkbank was.

The model predicts, it does not persuade. A hazard ratio of 0.55 tells you that onboarded accounts stay longer, not that pushing an account through onboarding will make it stay; the businesses that finished on their own may have been the ones who were going to stay anyway. The only way to know is to test the intervention, which is what chapter 20 of this series is about.

How I do this for clients

The deliverable is a survival model, an LTV table by segment and a one page decision memo, and it takes about a month.

The data I need: subscription or order history with start and end dates, the plan or product, and whatever you record about each customer's first weeks: onboarding steps, seats, acquisition channel, early support contact. An export from Stripe, Chargebee, Solidus or your own database is enough. I do not need it clean; I need it complete.

The first month starts with the free workshop, half a day working out which decision the model should change: when to phone people, what to pay for a lead, whether the annual plan is worth pushing. Then two weeks of real work at my own risk: Kaplan Meier curves by plan and cohort, a first Cox model with its hazard ratios, a draft LTV table. If that fortnight produces nothing you would act on, you owe me nothing and keep the code.

If we continue, you get the fitted model as code you own, a scored list of every account with its predicted twelve month survival and remaining value, the LTV table by segment, and a memo with one recommendation, one number and one risk. For example: "phone Starter accounts that have not onboarded by day 14; the model says this addresses 38% of first year churn; the risk is that onboarding is a marker rather than a cause, so we test it on half the accounts first." If you want, I also build a one question dashboard: last month's cohort against the model, so you see drift before it hurts.

The work sits under Data Science, and when the output resets acquisition bids I run that side under Performance Marketing, where a commission based arrangement is possible. What it costs in plain terms is on the pricing page: a fixed monthly retainer for a fixed capacity, no licence fees, and everything I build is yours.

Questions to ask your own team

  • Does our churn model tell us when a customer is likely to leave, or only whether?
  • What does the hazard look like by month of life, and where does it peak?
  • Is the LTV in our board deck descriptive or predictive, and what discount rate and horizon does it use?
  • Do we have one LTV or one per segment, and does our bidding use the segment numbers?
  • What test would prove that our retention intervention causes the effect the model predicts?

This series is inspired by Mike Grigsby's Marketing Analytics (Kogan Page). The explanations, examples and numbers here are my own.

If you have a subscription or order history and a churn number you do not quite trust, send it my way. In the free workshop we work out which decision a survival model should change for you, whether that is when to phone people, what to pay for a lead or whether the annual plan is worth pushing. Then I spend two weeks building the Kaplan Meier curves, a first Cox model and a draft lifetime value table at my own risk. If nothing in it is worth acting on, you owe me nothing and you keep the code. Book the workshop or just send me the question you are stuck on.

1%of every invoice goes to a UK charity you pick.

A donation, never sponsorship. You choose the cause at onboarding.

The story behind the pledge →

Stay ahead of your competition.

The latest innovative products and services, straight to your inbox before your competitors hear about them.

Get up to 5% off your first six months: 1% per topic you pick, the full 5% when you take everything. Limited offer · ends 31 December 2026.

New clients only. Terms apply.

* Up to 5% off your first six monthly invoices, new clients only. Full terms.

Questions about pricing, contracts or how we work together?

Read the FAQ