1. Customer Lifetime Value (CLV) basics
Great work on predicting customer churn! In this chapter, we will explore the Customer Lifetime Value concept, and different ways to calculate it. Then, we will learn how to use regression to predict customer transactions in the next month.
2. What is CLV?
The customer lifetime value is a measurement of how much a company expects to earn from an average customer in a lifetime. It can be historical - where we sum up each customer's profit and get the actual customer value. Another alternative is to predict the customer lifetime value which is a bit more complex. There are a number of methods to predict customer lifetime value. We will not delve into the complex prediction methods like Pareto / NBD or beta-geometric / NBD models which would take a full course of their own. Instead, we will use simple traditional methods to get decent estimates. Also, we will learn how to predict continuous variables like number of purchases with regression.
3. Historical CLV
Historical customer lifetime value is simply a sum of the revenues of customer transactions, multiplied by the average or product-level profit margin. Alternatively, we can sum up the actual profit from each purchase, if that data is available.
The main challenge with the historical approach is that it does not account for customer tenure, retention and churn rates. If the company is acquiring a lot of new customers - their average historical lifetime value will be deflated due to their short tenure.
The second challenge is that the new customers are treated the same way as tenured customers, therefore the average customer lifetime value does not represent the potential future revenue.
4. Basic CLV formula
The most basic lifetime value calculation is to take the average revenue per customer within a certain period, let's say a month, multiply it by the profit margin, and then multiply the result by the average or expected customer lifespan. The lifespan can be defined using company's knowledge about its customers, or analyzing the average time it takes for customers to churn.
5. Granular CLV formula
A more granular version of the basic customer lifetime value formula looks at each transaction. Here, we multiply the average revenue per purchase or transaction with the average frequency within a defined period - for example a month - and then multiply that with the profit margin. Afterwards, we multiply the result with the average customer lifespan. This method accounts for the frequency of the transactions within a certain timeframe, as well as the average revenue per transaction, therefore capturing more granular data points. Still, it does not account for customer retention rates, and assumes the frequency and revenue per transaction will stay the same within the defined lifespan.
6. Traditional CLV formula
The traditional formula is the most popular descriptive customer lifetime value technique. It incorporates retention and churn rates. We calculate it by multiplying the average revenue with the profit margin, and then with the ratio of retention to churn. Churn is defined as 1 minus retention. The retention to churn ratio gives us a multiplier, that acts as a proxy to expected length of the customer lifespan with the company. It is useful, but assumes that the churn is final, therefore the timeframe used for the retention and churn is critical. Especially, in the non-contractual business setting, we need to make sure customers who are defined as churned within this timeframe, don't actually come back later.
7. Introduction to transactions dataset
We will work with an open source online retail dataset. It has transactions from a retailer with variables on money spent, quantity and other values for each transaction. This is a standard transactional dataset.
8. Introduction to cohorts dataset
We will also use the cohorts dataset that is derived from the online retail data. This dataset is created by assigning each customer to a monthly cohort, based on the month they made their first purchase. Then a pivot table is built with the activity counts for each cohort in the subsequent months. We will use this dataset to calculate their retention rates. If you want to see how this dataset is calculated, you can check the Customer Segmentation in Python course where we build this and the other datasets from scratch.
9. Calculate monthly retention
The cohort dataset already has monthly active users for each monthly cohort. This means that in each row we have the same group of customers who started buying on month one, and then some of them come back in the subsequent months, while some don't. To calculate retention, we first build a cohort sizes dataset, which is just the first column from the cohort counts data. Then, we calculate the retention by dividing the cohort counts by the cohort sizes. We can also calculate customer churn rates, which is 1 minus retention.
Finally, we can plot the newly built retention table using heatmap function from seaborn package.
10. Retention table
As you can see, the first month retention is 100%. This is because this is the month when the customers had first started buying. And by definition this means all of the customers from this cohort are active in their first month.
11. Let's calculate some CLV metrics!
Great progress! Let's go ahead and practice calculating retention and churn metrics!