5D Library › Books › 5DL-B-048
算法营销、多触点沙普利归因与获客漏斗的随机控制
从汤普森采样多臂赌博机、吸收态马尔可夫转化链到客户终身价值(BG/NBD)预测及《孙子兵法·势篇》考辨
Algorithmic Marketing, Multi-Touch Shapley Attribution and Stochastic Control of Acquisition Funnels: From Thompson Sampling Bandits and Absorbing Markov Chains to BG/NBD Customer Lifetime Value, Read Beside the Strategic Dispositions of the Sunzi
DOI10.5281/zenodo.23836264摘要
一笔成交该算在哪个广告渠道头上?一个 A/B 测试什么时候可以停?一位客户还值多少钱?本书是教学与研究用的数学模型,不是营销、投资或法律建议。它依次讨论:末次点击、首次点击与线性归因在一个已知真实增量的虚构世界中的误差(末次点击把 7,299 次成交记在广告名下,广告实际造成约 3,636 次),沙普利值归因(Shapley 1953;Shao 与 Li、Dalessandro 等人的版本)与吸收马尔可夫链移除效应(Anderl 等 2016)的定义、它们对特征函数 v(S) 的依赖与在协同渠道上的分歧——并说明二者在观测数据上分配的是相关性而不是因果增量:有定向投放时,观测沙普利值的份额误差为 13.1 个百分点,与末次点击同一量级;只有随机化的持出、幽灵广告实验能给出增量(Lewis 与 Rao 2015、Gordon 等 2019、Johnson 等 2017、Blake 等 2015);可选停止的精确第一类错误(名义 5% 时看 5 次为 14.2%、20 次为 24.8%、100 次为 37.4%,「25%+」只在约 20 次以上成立)、波科克与奥布赖恩—弗莱明群序贯边界及混合序贯概率比检验(始终有效推断);汤普森采样与 A/B/C 测试的后悔比较,以及自适应分配下样本均值的负偏差与逆倾向加权修正;BG/NBD 与 Gamma-Gamma 模型的纯标准库实现(₂F₁ 用级数与普法夫变换后的欧拉积分互相核对)、Gamma-Gamma 的独立性假设,以及「留存率随时间上升」——这是异质性造成的分选效应(sBG 模型精确重现 Fader 与 Hardie 2007 年的参数),不是辛普森悖论,书中另造一个真正的辛普森悖论例子;巴斯扩散模型、多夫曼—斯坦纳条件(广告/销售额 = 广告弹性/价格弹性,静态规则)以及作者的「全周期最优买量」模型(凹响应下前重后轻;在一条 S 形响应曲线上,月均预算较低时隔月脉冲更好,分界约在 30–32.5 千之间,并不等于拐点)。
第七章与《孙子兵法》的《计篇》「势者,因利而制权也」和《势篇》「激水之疾,至于漂石者,势也;鸷鸟之疾,至于毁折者,节也」「是故善战者,其势险,其节短」并读(据杨丙安《十一家注孙子校理》,作者框架脱「是」字已补;「疾」字据翟林奈注《太平御览》引作「击」,正文从十一家注本作「疾」,待纸本校记确认),用作者的商誉存量模型说明「蓄势」与「短节」作为类比的含义与限度。第八章给出归因、实验、生命周期价值与预算四步核查表,以及一项预注册的模拟基准研究:在独立第三方冻结、已知真实增量的合成多渠道数据生成器上,比较观测沙普利归因与末次点击对真实增量份额的误差(唯一主要结局为二者平均绝对误差之差,最小关注效应 2 个百分点,90% 把握度需要 79 个合成世界、计划 90 个,判定规则写成代码)。书中以标注框区分已发表的证据、可运行的 Python 计算(16 段程序)、原典与作者的模型和假说;书中所有数据都是虚构或模拟的。
关键词:营销归因;多触点归因;沙普利值;马尔可夫链归因;移除效应;增量;随机持出;幽灵广告;A/B 测试;可选停止;群序贯设计;始终有效推断;汤普森采样;多臂赌博机;自适应实验;BG/NBD 模型;Gamma-Gamma 模型;客户终身价值;移位贝塔几何模型;巴斯扩散模型;多夫曼—斯坦纳定理
Abstract
Which advertising channel should a sale be credited to? When may an A/B test stop? What is a customer still worth? This book presents mathematical models for teaching and research and is not marketing, investment or legal advice. It covers the errors of last-click, first-click and linear attribution in a fictional world whose true incrementality is known (last click credits 7,299 conversions to ads, which caused about 3,636); Shapley-value attribution (Shapley 1953; the versions of Shao and Li and of Dalessandro and co-authors) and the removal effect of an absorbing Markov chain (Anderl and co-authors 2016), their dependence on the characteristic function v(S) and their disagreement on synergistic channels — and shows that on observational data both allocate correlation, not causal increments: with targeting, observational Shapley shares are off by 13.1 percentage points, the same order as last click; only randomised holdouts and ghost-ad experiments measure increments (Lewis and Rao 2015, Gordon and co-authors 2019, Johnson and co-authors 2017, Blake and co-authors 2015); the exact type I error of optional stopping (at a nominal 5 %, 14.2 % with 5 looks, 24.8 % with 20 and 37.4 % with 100, so "25 %+" holds only from about 20 looks), Pocock and O'Brien–Fleming group-sequential boundaries and the mixture sequential probability ratio test (always-valid inference); the regret of Thompson sampling against an A/B/C test, the negative bias of sample means under adaptive allocation and its inverse-propensity correction; standard-library implementations of the BG/NBD and Gamma-Gamma models (₂F₁ by its series and by Euler's integral after Pfaff's transformation, each checking the other), the independence assumption of Gamma-Gamma, and "retention rising over time", which is a sorting effect of heterogeneity (the sBG model reproduces Fader and Hardie's 2007 estimates exactly), not Simpson's paradox, with a genuine Simpson's paradox built separately; the Bass diffusion model, the Dorfman–Steiner condition (advertising-to-sales ratio = advertising elasticity / price elasticity, a static rule) and the author's model of "whole-life optimal acquisition spend" (front-loaded under concave response; on one S-shaped response curve, alternate-month pulsing is better at lower monthly budgets, with a switch at about 30–32.5 thousand that does not coincide with the inflection point).
Chapter 7 reads these beside the Sunzi's "Initial Estimates" ("shi is to shape one's plans according to advantage") and "Strategic Dispositions" ("the swiftness of rushing water, to the point of tossing stones about, is shi; the swiftness of a hawk, to the point of breaking its prey, is jie"; "therefore his shi is steep, his jie short"), following Yang Bing'an's collated Eleven Commentaries (the 是 missing from the author's framework is restored; according to Giles the Taiping yulan quotes 疾 as 击, while the main text follows the Eleven Commentaries in reading 疾, pending the printed collation notes), and uses the author's goodwill-stock model to show what "storing force" and "a short release" mean as an analogy, and where the analogy ends. Chapter 8 gives a four-step checklist (attribution, experiments, lifetime value, budget) and a pre-registered simulation benchmark: on a synthetic multichannel data generator with known true increments, frozen by an independent third party, observational Shapley attribution is compared with last click on their error against the true incremental shares (single primary outcome the difference in mean absolute errors, smallest effect of interest 2 percentage points, 79 synthetic worlds for 90 % power, 90 planned, decision rule written as code). Marked boxes separate published evidence, runnable Python calculations (16 programs), classical sources and the author's models and hypotheses; all data in the book are fictional or simulated.
Keywords: marketing attribution; multi-touch attribution; Shapley value; Markov chain attribution; removal effect; incrementality; randomized holdout; ghost ads; A/B testing; optional stopping; group sequential design; always-valid inference; Thompson sampling; multi-armed bandit; adaptive experiments; BG/NBD model; Gamma-Gamma model; customer lifetime value; shifted-beta-geometric model; Bass diffusion model; Dorfman-Steiner theorem
目录 · Contents
- 序:归因、实验与客户的价值English 中文Preface: Attribution, Experiments and the Value of a Customer
- 第一章 归因不是增量:末次点击、潜在结果与随机持出English 中文Chapter 1 Attribution Is Not Incrementality: Last Click, Potential Outcomes and Randomised Holdouts
- 第二章 沙普利值与马尔可夫移除效应:精确的分配,不精确的问题English 中文Chapter 2 Shapley Values and Markov Removal Effects: Exact Allocations of an Inexact Question
- 第三章 偷看的代价:可选停止、群序贯设计与始终有效推断English 中文Chapter 3 The Price of Peeking: Optional Stopping, Group-Sequential Designs and Always-Valid Inference
- 第四章 边做边学:汤普森采样与自适应实验的估计偏差English 中文Chapter 4 Learning While Earning: Thompson Sampling and the Bias of Adaptive Experiments
- 第五章 一位客户还值多少钱:BG/NBD、Gamma-Gamma 与留存率的假象English 中文Chapter 5 What Is a Customer Still Worth? BG/NBD, Gamma-Gamma and the Illusion of Rising Retention
- 第六章 扩散与买量:巴斯模型、多夫曼—斯坦纳条件与全周期支出English 中文Chapter 6 Diffusion and Spend: the Bass Model, the Dorfman–Steiner Condition and Whole-Life Budgets
- 第七章 原典并读:《孙子兵法》的「势」与「节」English 中文Chapter 7 Reading the Classics: *Shi* and *Jie* in the *Sunzi*
- 第八章 实践与预注册检验English 中文Chapter 8 Practice and a Pre-Registered Test
How to cite · 引用
Fan, Y. (2026). Algorithmic Marketing, Multi-Touch Shapley Attribution and Stochastic Control of Acquisition Funnels: From Thompson Sampling Bandits and Absorbing Markov Chains to BG/NBD Customer Lifetime Value, Read Beside the Strategic Dispositions of the Sunzi [算法营销、多触点沙普利归因与获客漏斗的随机控制] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.23836264
BibTeX
@book{fan2026algorithmic,
title = {{Algorithmic Marketing, Multi-Touch Shapley Attribution and Stochastic Control of Acquisition Funnels}: From Thompson Sampling Bandits and Absorbing Markov Chains to BG/NBD Customer Lifetime Value, Read Beside the Strategic Dispositions of the Sunzi},
author = {Fan, Yafu},
year = {2026},
publisher = {5D Library},
edition = {Version 1.0.0},
doi = {10.5281/zenodo.23836264},
url = {https://doi.org/10.5281/zenodo.23836264},
note = {Chinese title: 算法营销、多触点沙普利归因与获客漏斗的随机控制}
}
| DOI | https://doi.org/10.5281/zenodo.23836264 |
|---|---|
| DOI(全部版本 all versions) | https://doi.org/10.5281/zenodo.23836263 |
| ORCID | https://orcid.org/0009-0004-3519-1203 |
| 5D Library ID | 5DL-B-048 |
| 版本 Version | 1.0.0 · 中英双语版 Bilingual edition |
| 出版日期 Date | 2026-10-31 |
| 网址 Online | https://5dlibrary.com/books/algorithmic-marketing-shapley-attribution-funnels/ |
| SHA-256 · algorithmic-marketing-shapley-attribution-funnels_bilingual_v1.0.0.pdf | 7dd6866b903477c03dd8aa8d634cdc6195894d992d7be91795a0a478eb528b8a |
| SHA-256 · algorithmic-marketing-shapley-attribution-funnels_en_v1.0.0.pdf | a17ea30adb40f8d9f432f15470e06404b704c2b0579b7d9d19ba4b46fb12c976 |
| SHA-256 · algorithmic-marketing-shapley-attribution-funnels_zh_v1.0.0.pdf | 6d34a81546e885977a5f430b30399b8d19202384ee6dab8683aed0ae7f31e7c2 |
| Licence · 许可 | Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0). https://creativecommons.org/licenses/by-nc-nd/4.0/ |
Disclosure. The author uses the works of 5D Library, including this book, as the methodological basis of his community courses, the 5D Ascension Cards (Dimensional Shift Card Decks) and the Yafu AI knowledge base, and therefore has a commercial interest in the subject of this book. The book promotes no course, card deck or service; the Chapter 8 trial is designed to be run and analysed by researchers independent of the author's business and does not recruit from the author's community, students or customers; all the code and the study protocol are published openly for anyone to check. The author founded and runs Asia Influencer X and Yafu Global, which work in influencer marketing, live-stream commerce and digital marketing (including ad buying, performance attribution and customer acquisition) and use the attribution and experimentation methods discussed in this book in their daily work, so he has a direct commercial interest in its subject; the book uses no data from these two companies or their clients as evidence and does not promote their services.