RFM Analysis and Modelization

The business problem

  • Problem: we don't understand our customer. We don't know if a specific customer is relevant for our organization.
  • Goals:
    • We want to know how much value a customer is generating for the organization.
    • We want to know how the generated value is going to evolve.
    • We want to segment customers based on value.
  • Why? To perform specific actions for different customer groups

But attention, our organization is starting the customer analytics journey and we can not propose really sophisticated techniques.

Technique to solve the business problem

RFM Analysis is a customer segmentation method based on:

  • Recency
  • Frequency
  • Monetary

It is easy to implement and understand. It is based on pareto principle: 20% of customers generate 80% of revenue.

When to use it: Used for non-contractual purchasing.

Main Concepts

The main concepts are:

  • Recency: the number of days that have passed since the customer last purchased - How recently did the customer purchase?
  • Frequency: number of purchases in a specific period (for example, last 12 months) - How often do they purchase?
  • Monetary: value of orders from a given customer in the specific period - How much do they spend?

Implementation Process

  • [BU] Discuss whether RFM fits as a metric in our business
  • [DP] Identification and understanding of sources and metadata
  • [DP] Extract, clean and load data
  • [M] Create R,F,M variables per customer
  • [M] Assign RFM percentile (use from 5 -offline- up to 10 -online- percentile segments)
  • [E] Analyze results
  • [D] Present and explain the results

Benefits

This technique provides the following benefits:

  • It is a customer segmentation easy to calculate and understand
  • Good fit for direct marketing: Which are the best segments? Who do I need to contact?
  • Helps to improve CLV
  • Helps to reduce churn (instead using other more complex techniques)
  • Can be extended with location dimension (RFML)
  • Provides some kind of insight about loyalty

Use cases

This technique is used in different use cases:

  • Forecasting and Sales reporting based on RFM
  • RFM profiling
  • Churn Analysis
  • Marketing actions: mailing, call center,...

How to implement RFM using R

# Install packages
install.packages("readr")
install.packages("dplyr")
install.packages("DataExplorer")

# Load packages
library(dplyr)
library(ggplot2)
library(readr)
library(DataExplorer)

# Load data
sales_data <- read.csv("data/s4.csv",stringsAsFactors=FALSE)

# Review data
str(sales_data)
View(sales_data)
summary(sales_data)

# Create recency
sales_data$Recency <- round(as.numeric(difftime(Sys.Date(),
                            sales_data[,3],units="days")) )

# Creation of Recency, Frequency y Monetary 
salesM <- aggregate(sales_data[,2],list(sales_data$idCustomer),sum)
names(salesM) <- c("idCustomer","Monetary")
salesF <- aggregate(sales_data[,2],list(sales_data$idCustomer),length)
names(salesF) <- c("idCustomer","Frequency")
salesR <- aggregate(sales_data[,4],list(sales_data$idCustomer),min)
names(salesR) <- c("idCustomer","Recency")

# Combination R,F,M
temp <- merge(salesF,salesR,"idCustomer")
salesRFM <- merge(temp,salesM,"idCustomer")

#  Creation of R,F,M rank
salesRFM$rankR <- cut(salesRFM$Recency,5,labels=F)  
salesRFM$rankF <- cut(salesRFM$Frequency,5,labels=F)  
salesRFM$rankM <- cut(salesRFM$Monetary,5,labels=F)     

# Review top 10
salesRFM <- salesRFM[with(salesRFM, order(-rankR, -rankF, -rankM)), ]
head(salesRFM, n=10)

# Analysis
groupRFM <- count(salesRFM, rankR, rankF,rankM)
groupRFM <- salesRFM$rankR*100 + salesRFM$rankF*10 + 
salesRFM$rankM
salesRFM <- cbind(salesRFM,groupRFM)

# Plot
ggplot(salesRFM, aes(factor(groupRFM))) +
  geom_bar() +
  ggtitle('Customer Distribution by RFM') +
  labs(x="RFM",y="# Customers") + 
  theme(plot.title = element_text(color="#666666", face="bold", size=16, hjust=0)) +
  theme(axis.title = element_text(color="#666666", face="bold"))

References

results matching ""

    No results matching ""