M1-045M1: Mathematics & Statistics FundamentalsHypothesis TestingHard
⚡Flashcard Drill➔Mastery:
Explain Sequential Testing and the Peeking Problem, and Detail Correct Continuous Monitoring Frameworks
📐 Mathematical Definition
⚡ One-Sentence Core Answer
The Peeking Problem occurs when continuously checking p-values and stopping once , which inflates false positive rates from 5% to over 30%; resolved via alpha spending or sequential probability ratio tests.
📌 Key Takeaways
- •The Peeking Problem: Repeatedly evaluating fixed-horizon tests over time turns the decision into , guaranteeing eventual false positive crossing by the Law of Iterated Logarithm.
- •Alpha Spending Function (Lan-DeMets / Pocock / O'Brien-Fleming): Allocates portions of total significance budget across intermediate evaluation points.
- •Always-Valid Inference (mSPRT / e-values): Constructs nonnegative supermartingales allowing arbitrary, continuous real-time peeking without inflating Type I error.
📐 Mathematical Derivations
Law of the Iterated Logarithm (LIL): For standardized random walk , almost surely under . Because , the sample path will cross any fixed threshold with probability 1 as . Hence, peeking daily for 30 days inflates effective to . The Mixture Sequential Probability Ratio Test (mSPRT, Johari et al., 2017) computes test statistic . By Ville's inequality for supermartingales, , guaranteeing valid inference at all stopping times.
🏭 Production Trade-offs
Standard fixed-horizon A/B testing forbids inspecting results before reaching the planned sample size . However, product teams want to stop losing experiments early to minimize revenue destruction. Modern platforms (Optimizely, Netflix, Uber) implement mSPRT or O'Brien-Fleming boundaries, enabling continuous monitoring dashboards with rigorous statistical guarantees at the cost of slightly higher average sample size.
⚠️ Common Interview Pitfalls
- ✕Checking the A/B dashboard every morning and turning off the experiment the moment .
- ✕Treating standard confidence intervals as valid when early stopping rules were applied.
🎯 Interviewer Follow-up Inquiries
- ?How does Ville's inequality for nonnegative supermartingales provide time-uniform confidence boundaries?
- ?What is the difference between Pocock boundaries (constant threshold) and O'Brien-Fleming boundaries (conservative early on)?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
📚
Associated Knowledge Base Guides & Mindmaps
Explore the comprehensive technical article, exam cards, and global architecture tree.
中文速览与面试要点
什么是序贯检验与 peeking 问题?如何正确做序贯实验。
反复查看并随时停止会极大抬高假阳性;需用 alpha-spending 或 always-valid 方法。
核心要点
- peeking 问题的数学本质:经典假设检验的 α 是 一次性 检验的假阳性率,其推导假设检验只做一次。若在数据累积过程中反复检验并在任一次显著时停止(optional stopping),假阳性率会随检验次数单调上升——对布朗运动式的随机游走,连续监控下的最终假阳性率趋向 1 (因为随机游走几乎必然会在某个时刻越过任意有限阈值)。直觉上,这相当于把'一次抽样'变成'多次抽样取最大',而最大值的分布远比单次抽样极端。这是 A/B 测试中'跑三天看到显著就上线'的经典陷阱。
- 三类正确做法:① 固定时长/固定样本量 ——最简单的解法,预先用功效分析定 n,跑满再分析一次;缺点是无法提前止损(若效应明显为负也只能跑完)。② Group Sequential(分组序贯) ——预先指定 k 次中期分析,用 alpha-spending 函数(如 O'Brien-Fleming)分配 α 预算,早期检验用更严阈值(因为早期数据少、波动大),总 α 仍为 0.05。这是临床试验的标准做法。③ Always-valid 推断 ——用 mSPRT (混合序贯概率比检验)或 confidence sequences 构造在任何停止时刻都有效的置信区间,可随时查看而不失真;代价是区间略宽(功效略低)。补充说明: 贝叶斯 A/B 在一定程度上规避该问题 ——后验随数据更新是合法的,P(p_A>p_B) 不会因反复查看而系统性失真(但若用后验做频繁的'上线/不上线'决策仍需考虑预期损失)。
- 固定时长实验是简单解法
- Sequential test / group sequential / mSPRT 允许安全 peeking
常见陷阱
- 跑几天看到显著就停止(peeking 导致假阳性膨胀)
- 认为贝叶斯方法完全无需考虑停止规则