A quick guide to the RFM model for data scientists

The RFM model measures Recency, Frequency, and Monetary value and is used to predict future customer behaviour and segment customers based on their value. Here's how it works.

A quick guide to the RFM model for data scientists
Pictures by Kampus and Christina Morillo, Pexels.
13 minutes to read

The RFM model is probably one of the best known and most widely used customer segmentation models by data driven marketers. It’s used for both measuring customer value and predicting future customer behaviour and has been in regular use since the 1970s.

However, despite being such an old model, RFM analysis is still commonly used today and is still the subject of ongoing research and development to help improve business performance. Yet, oddly, many marketers are often unaware of RFM, or why and how it works. In this quick guide, I’ll explain…

What is RFM?

RFM stands for Recency (R), Frequency (F), and Monetary value (M). These three dimensions define how recently a customer purchased, how many times they ordered, and how much money they spent, and are a powerful indicator of customer value and a predictor of future behaviour. Using RFM can help marketers understand their customer segments, contact customers at the right time with the right offers, and market more profitably.

In RFM analysis raw data is collected on each customer’s purchase behaviour from which the raw RFM variables are calculated. An RFM model is then used to “bin” each of these values into five groups called quintiles, which are numbered 1 through 5.

This gives each customer a score for R, F, and M from 1 to 5, according to their Recency, Frequency, or Monetary value. The higher the number the more recent, frequent, or high-spending the customer.

The individual R, F, and M scores are then aggregated to form an overall RFM score, such as 111 or 555. Since 5 x 5 x 5 = 125, this gives a total of 125 different RFM score permutations, such as 111, 153, and 555, each of which describes a segment of customers.

The RFM model is based on the assumption that customers who have been purchased more recently, have placed more orders, and that customers who spend more money with the business are likely to be more valuable and are more likely to shop again than those that have not. Although it’s simple, this assumption is surprisingly effective.

How are RFM scores used?

RFM scores, and the underlying raw RFM variables upon which they are based, can be used in a variety of ways. The main application is to allow marketers or sales staff to quickly and easily understand each customer’s value and purchase behaviour without the need to analyse any data.

Since an RFM score is very easy to interpret, you can quickly ascertain the relative Recency, Frequency, or Monetary value of each customer in relation to the rest.

For example, a 111 score denotes the least valuable customers who have not been seen recently, have not placed many orders and have not spent much, while a 555 denotes the most valuable customers who have shopped recently, have placed lots of orders and have spent a great deal.

RFM score Description
111 Low value customer: A customer who is the least recent, has placed the least number of orders, and has spent the lowest amount. You may want to try and reactivate these, or market to them less frequently.
511 New customers: A customer who is the most recent, but has placed the least number of orders, and has spent the lowest amount. To prevent them being one-time customers, these can be targeted to get them to return.
155 High value lapsed customer: A customer who is not recent but who has placed a high number of orders and spent a high amount. It would be worthwhile trying to win these customers back.
555 High value customer: A customer who is the most recent, has placed the highest number of orders, and has spent the greatest amount. These big spenders are very valuable and benefit from preferential treatment to retain them.

Applications of RFM models

As with many of the traditional models used in marketing science, the RFM model was originally developed for catalogue marketing by direct marketers. Catalogues are notoriously expensive to create, print, and distribute, so direct marketers needed a way to reduce the high costs of sending direct mail by ensuring it was reaching the best customers.

At a basic level, data scientists would take the customer data and calculate the Recency, Frequency, and Monetary value for each customer, assign RFM scores. They’d then examine the correlation between the RFM scores and the likelihood for each RFM quintile, or range of RFM segments, to purchase. They’d then create their mailing list based on specific RFM scores.

Effectively, by selecting only those customers whose RFM scores meet certain criteria, you can select the customers most likely to purchase and avoid sending costly catalogues to those who won’t. RFM segmentation, therefore, works primarily in helping to target customers who are likely to purchase and increases profits by not mailing those who probably won’t. It increases profit by cutting costs.

Programmer

How to create an RFM model

As far as marketing models go, RFM models and RFM analysis are definitely at the easier end of the spectrum, often (but not always) requiring no machine learning skills and only access to basic transactional dataset. A decent data scientist should easily be able to create an effective RFM model in a day - indeed, my EcommerceTools data science toolkit allows you to create an RFM model in a few minutes.

1. Obtain your transactional data

The first step is to obtain a transactional dataset. This needs to include only four basic fields: the order ID, the customer ID, the order date, and the value of the order. You can calculate each of the RFM metrics from these data.

2. Calculate Recency

Recency measures the number of days since each customer placed their last order. This can be calculated from transactional data by obtaining the maximum order date for each customer order and then calculating a time delta from the current date in days.

Since the recency score metric and other RFM values are time-linked, it’s important to recalculate them regularly - typically every day, or immediately before the data are required.

3. Calculate Frequency

Frequency measures the number of orders placed by each customer. Some authors calculate the Frequency score based on a given period, such as the total number of orders placed in the past 12 months.

However, I personally prefer setting it to the customer’s lifetime, with no time limit, as this can help you spot lapsed customers much more easily and separates single-purchase customers better. This is known as the “life to date” approach. Either way, it’s easy to calculate Frequency - simply count the unique order IDs for each customer from the transactional data.

4. Calculate Monetary value

Monetary value measures the total revenue generated by each customer. As with Frequency, some authors like to set a time period, such as the past 12 months, when calculating this. However, this can conceal useful insights in businesses where the purchase latency is high, or where there is seasonality, so I would recommend that you look at the customer lifetime instead. To calculate monetary values, simply sum the total revenue for each customer.

3. Assign RFM scores

Once the raw RFM variables have been calculated, for example, the number of days since the customer’s most recent order, the total number of orders placed, and the total amount spent, the data are split into five scores known as quintiles.

There are several ways to assign RFM scores to the underlying RFM variables, each with its own advantages and disadvantages - the two most common are quantile based discretization or binning, and K-means clustering. The method you select will depend on the skewness of your data, and how you intend to use the RFM scores.

Equal binning

The traditional way to assign RFM scores was to take each metric and assign quintile scores from 1 through 5 based on equal bin sizes. For example, let’s assume you have 5000 customers and had calculated the number of days since each of their last orders to assign a Recency score. Using the equal binning approach of RFM segmentation, you’d have 1000 in each quintile or RFM cell from 1 through 5, making the scores very easy to understand.

The disadvantage of this simple binning approach is that customer data are often heavily skewed. Most customer databases tend to have huge numbers of customers who have only ever placed a single order. If 60% of your customers met this criterion, then equal binning would mean that 3000 of them would be assigned R scores from 1 to 3, even though there was actually no difference in the underlying metric.

This is less likely to be an issue if your RFM model defines a specific time period, such as orders from the last 12 months, but it can lead to lower quality segmentation data when you use an open time period, and in my experience, these are the most practical ones to use.

Unequal binning

Unequal binning aims to overcome the data skewness issue that can make equal binning ineffective. Rather than simply dividing up each variable into quintiles or segments of equal size, unequal binning aims to segment customers based on the similarity of the data, or specific bounds.

The benefit of this approach is that, for example, all of your single order customers get assigned the lowest F score of 1, and you have more usable and more granular data in the RFM segments above.

There are various ways to do this, but K-means clustering is the most popular. Before applying this technique to the often heavily skewed data you encounter during RFM analysis, you’ll likely need to log transform the data first. Here’s a step-by-step guide to creating RFM scores using K-means clustering.

4. Optionally, assign labels

That’s really all you need to do to get usable RFM segments. However, one popular additional technique is to assign labels to the RFM scores to help less technical marketers or sales people understand the customer segments, without the need to understand RFM segmentation first.

This approach simply groups together the 125 different RFM scores into a smaller combination of descriptive customer segments, such as Risky, Hold and Improve, Potential Loyal, Loyal, and Star, based on some specific criteria. The various segment names are often easier for people to understand and allow RFM segment visualisation.

5. Apply RFM analysis

The other highly recommended approach is to apply RFM analysis - effectively analysing the behaviour of each RFM cell to see how it relates to future customer behaviour and customer value. One common technique here is to examine the response rate of each RFM cell.

This can reveal which cells are responding to marketing and which aren’t, allowing you to stop mailing those in unprofitable cells, or change the way you market to the cells to try to increase the response rate obtained from marketing.

There’s typically a very strong relationship between customers with a higher RFM score responding to marketing (or often just purchasing anyway) than those in lower value cells. Recency, of course, is the slightly unusual one, since customers who have just purchased may not always purchase again immediately afterwards. However, they’re significantly more likely to do so than customers with low recency or low frequency scores.

RFM vs machine learning

While RFM itself has been around for decades and is relatively simple, it remains very effective when used correctly. Even after over 40 years of using RFM, marketing scientists are still regularly researching the technique and contributing new ideas.

Although some who work in marketing science are now using machine learning techniques, such as uplift models and response models, to predict with greater accuracy who will purchase when marketed to, the underlying RFM metrics - Recency, Frequency, and Monetary value - remain important as model features in virtually every marketing model.

Further reading

  • Miglautsch, J.R., 2000. Thoughts on RFM scoring. Journal of Database Marketing & Customer Strategy Management, 8(1), pp.67-72.
  • Oztaysi, B. and Kavi, M., 2020, July. Fuzzy RFM Analysis: An Application in E-Commerce. In International Conference on Intelligent and Fuzzy Systems (pp. 1225-1232). Springer, Cham.
  • Zhaung, Y., 2018. Research on E-commerce Customer Churn Prediction Based on Improved Value Model and XG-Boost Algorithm. Management Science and Engineering, 12(3), pp.51-56.

Matt Clarke, Saturday, August 28, 2021

Matt Clarke Matt is a Digital Director who uses data science to help in his work. He has a Master's degree in Internet Retailing (plus two other Master's degrees in different fields) and specialises in the technical side of ecommerce and marketing.

Extreme Gradient Boosting with XGBoost

Learn the fundamentals of gradient boosting and build state-of-the-art machine learning models using XGBoost to solve classification and regression problems.

Start course for FREE

Comments