ecom-rfm-analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

RFM Analysis

RFM分析

Overview

概述

RFM segments customers based on three behavioral dimensions: Recency (when they last bought), Frequency (how often they buy), and Monetary (how much they spend). It converts raw transaction data into actionable customer segments for targeted marketing.
RFM基于三个行为维度对客户进行细分:Recency(最近一次购买时间)、Frequency(购买频率)和Monetary(消费金额)。它将原始交易数据转化为可落地的客户分群,用于精准营销。

Framework

框架

IRON LAW: RFM Uses ACTUAL Behavior, Not Demographics

RFM is behavioral segmentation — it classifies by what customers DO,
not who they ARE. A 25-year-old and a 65-year-old in the same RFM segment
should receive the same treatment. Never mix RFM with demographic
assumptions.
IRON LAW: RFM Uses ACTUAL Behavior, Not Demographics

RFM is behavioral segmentation — it classifies by what customers DO,
not who they ARE. A 25-year-old and a 65-year-old in the same RFM segment
should receive the same treatment. Never mix RFM with demographic
assumptions.

The Three Dimensions

三个维度

DimensionWhat It MeasuresHow to Calculate
Recency (R)Days since last purchaseToday - Last purchase date
Frequency (F)Number of purchases in periodCount of distinct transactions
Monetary (M)Total spend in periodSum of transaction values
维度衡量内容计算方式
Recency (R)距离上次购买的天数当前日期 - 上次购买日期
Frequency (F)统计周期内的购买次数独立交易的数量
Monetary (M)统计周期内的总消费额交易金额总和

Scoring Method (Quintile-Based)

评分方法(基于五分位数)

  1. For each dimension, rank all customers and divide into 5 equal groups (quintiles)
  2. Score 5 (best) to 1 (worst): R=5 means most recent, F=5 means most frequent, M=5 means highest spend
  3. Combine into 3-digit RFM score (e.g., R5-F4-M5 = recent, frequent, high-value)
Note: For Recency, LOWER days = HIGHER score (more recent is better).
  1. 针对每个维度,对所有客户进行排名并划分为5个均等分组(五分位数)
  2. 评分从5(最佳)到1(最差):R=5表示最近购买,F=5表示购买频率最高,M=5表示消费金额最高
  3. 组合为3位RFM评分(例如:R5-F4-M5 = 近期购买、高频、高价值)
注意:对于Recency维度,天数越少,评分越高(越近期越好)。

Key Segments

核心客户群

SegmentRFM PatternDescriptionStrategy
ChampionsR5, F5, M5Best customers, recent, frequent, high-valueReward, loyalty program, early access
LoyalR4-5, F4-5, M3-5Consistent buyersUpsell, cross-sell, referral program
Potential LoyalistsR4-5, F2-3, M2-3Recent, moderate frequencyNurture to increase frequency
At RiskR2-3, F3-5, M3-5Were frequent/high-value, not buying recentlyWin-back campaign, special offers
HibernatingR1-2, F1-2, M1-2Long dormant, low valueLow-cost reactivation or let go
New CustomersR5, F1, M1-2Just made first purchaseOnboarding, second-purchase incentive
客户群RFM模式描述策略
冠军客户R5, F5, M5最佳客户,近期购买、高频、高价值奖励机制、忠诚度计划、优先体验
忠诚客户R4-5, F4-5, M3-5持续购买的客户向上销售、交叉销售、推荐计划
潜在忠诚客户R4-5, F2-3, M2-3近期购买、购买频率中等培育以提升购买频率
流失风险客户R2-3, F3-5, M3-5曾是高频/高价值客户,近期未购买赢回活动、专属优惠
沉睡客户R1-2, F1-2, M1-2长期未活跃、低价值低成本激活或放弃
新客户R5, F1, M1-2刚完成首次购买新用户引导、二次购买激励

Implementation Steps

实施步骤

Phase 1: Data Preparation
  • Required: Customer ID, Transaction Date, Transaction Amount
  • Clean: Remove refunds, test orders, internal orders
  • Set analysis window (typically 12-24 months)
Phase 2: Calculate RFM Scores
  • Calculate R, F, M for each customer
  • Assign quintile scores (1-5) for each dimension
  • Combine into segments
Phase 3: Segment and Act
  • Map each customer to a named segment (Champions, At Risk, etc.)
  • Design targeted actions per segment
  • Measure results: did targeted customers behave differently?
阶段1:数据准备
  • 所需数据:客户ID、交易日期、交易金额
  • 数据清洗:移除退款、测试订单、内部订单
  • 设置分析周期(通常为12-24个月)
阶段2:计算RFM评分
  • 为每位客户计算R、F、M值
  • 为每个维度分配五分位数评分(1-5)
  • 组合为客户群
阶段3:分群并行动
  • 将每位客户映射到对应的命名客户群(冠军客户、流失风险客户等)
  • 针对每个客户群设计精准行动方案
  • 衡量结果:精准触达的客户行为是否发生变化?

Output Format

输出格式

markdown
undefined
markdown
undefined

RFM Analysis: {Business}

RFM Analysis: {Business}

Data Summary

Data Summary

  • Customers analyzed: {N}
  • Analysis window: {start} to {end}
  • Transactions: {N}
  • Customers analyzed: {N}
  • Analysis window: {start} to {end}
  • Transactions: {N}

Segment Distribution

Segment Distribution

SegmentCount%Avg R (days)Avg FAvg M
Champions{N}{%}{days}{count}${X}
At Risk{N}{%}.........
..................
SegmentCount%Avg R (days)Avg FAvg M
Champions{N}{%}{days}{count}${X}
At Risk{N}{%}.........
..................

Key Findings

Key Findings

  • Top 20% customers contribute {X%} of revenue
  • {N} customers at risk of churning (were high-value, now dormant)
  • {N} new customers need second-purchase nurturing
  • Top 20% customers contribute {X%} of revenue
  • {N} customers at risk of churning (were high-value, now dormant)
  • {N} new customers need second-purchase nurturing

Recommended Actions

Recommended Actions

SegmentActionChannelExpected Impact
Champions{loyalty reward}{email/app}Increase AOV by X%
At Risk{win-back offer}{email/SMS}Recover X% of dormant revenue
undefined
SegmentActionChannelExpected Impact
Champions{loyalty reward}{email/app}Increase AOV by X%
At Risk{win-back offer}{email/SMS}Recover X% of dormant revenue
undefined

Gotchas

注意事项

  • RFM is backward-looking: It tells you what customers DID, not what they WILL do. Combine with predictive models (CLV prediction) for forward-looking insights.
  • Equal quintiles may not make sense: If 80% of customers bought only once, quintile 1-4 are all "one-time buyers." Consider custom breakpoints based on business context.
  • Monetary can be misleading for subscriptions: If everyone pays the same subscription fee, M dimension adds no information. Drop it and use RF only.
  • B2B vs B2C frequency differs: A B2B customer buying quarterly is "frequent." A B2C customer buying quarterly may be "at risk." Calibrate to business context.
  • Don't over-message At Risk customers: Bombarding dormant customers with emails can increase unsubscribes. One well-crafted win-back campaign is better than weekly emails.
  • RFM是回顾性分析:它告诉你客户过去的行为,而非未来的行为。结合预测模型(CLV预测)可获得前瞻性洞察。
  • 均等五分位数可能不适用:如果80%的客户仅购买过一次,那么五分位数1-4均为“一次性买家”。需结合业务场景设置自定义断点。
  • 消费金额维度对订阅业务可能无意义:如果所有用户支付相同的订阅费用,M维度无法提供有效信息。可移除该维度,仅使用RF分析。
  • B2B与B2C的购买频率差异:B2B客户每季度购买属于“高频”,而B2C客户每季度购买可能属于“有流失风险”。需根据业务场景调整标准。
  • 不要过度触达流失风险客户:向沉睡客户发送大量邮件可能增加退订率。一次精心设计的赢回活动效果优于每周发送邮件。

Scripts

脚本

ScriptDescriptionUsage
scripts/rfm_score.py
Score customers on R/F/M and assign segment labels
python scripts/rfm_score.py --help
Run
python scripts/rfm_score.py --verify
to execute built-in sanity tests.
脚本描述使用方式
scripts/rfm_score.py
为客户计算R/F/M评分并分配客户群标签
python scripts/rfm_score.py --help
运行
python scripts/rfm_score.py --verify
可执行内置的合理性测试。

References

参考资料

  • For Python/SQL implementation code, see
    references/rfm-implementation.md
  • For CLV prediction extending RFM, see
    references/clv-prediction.md
  • Python/SQL实现代码,请查看
    references/rfm-implementation.md
  • 基于RFM扩展的CLV预测,请查看
    references/clv-prediction.md