M1-083M1: Mathematics & Statistics Fundamentals实验设计 (A/B)Medium
⚡Flashcard Drill➔Mastery:
Explain Stratified Randomization in Experimental Design and When It Is Strictly Required
📐 Mathematical Definition
⚡ One-Sentence Core Answer
Stratified randomization divides the population into homogeneous strata based on key covariates (e.g. Operating system, spend tier) and randomizes within each stratum, guaranteeing perfect covariate balance and reducing treatment effect variance.
📌 Key Takeaways
- •Core Mechanism: Partitions population into mutually exclusive strata ; within each stratum, exactly of units are allocated to Treatment and to Control.
- •Guaranteed Balance: Eliminates the possibility of accidental pre-experiment covariate imbalance (e.g. 60% iOS in treatment vs 40% in control).
- •Variance Reduction: Removes between-strata variance from the standard error of treatment effect: .
📐 Mathematical Derivations
By the Law of Total Variance, population metric variance decomposes into: , where is stratum weight and is within-stratum variance. Under simple random assignment, variance of estimated treatment effect is . Under stratified randomization, because each stratum is balanced exactly, the between-strata component is completely purged from estimation noise: .
🏭 Production Trade-offs
When stratified randomization is mandatory: (1) Small sample experiments (, such as enterprise B2B A/B tests or hospital trials) where simple random sampling frequently produces bad imbalances. (2) Presence of heavy whales: In gaming or ad monetization, stratified bucketing based on historical spend tiers prevents top-spending 'whales' from clustering by chance into one bucket. In large-scale consumer apps (), simple randomization achieves balance by the Law of Large Numbers, making post-experiment CUPED adjustment mathematically equivalent and operationally simpler.
⚠️ Common Interview Pitfalls
- ✕Stratifying on post-treatment variables (must strictly stratify on pre-treatment baseline covariates).
- ✕Over-stratifying across too many crossed variables, leading to empty or single-unit strata.
🎯 Interviewer Follow-up Inquiries
- ?Why is post-stratification (or CUPED ANCOVA) asymptotically equivalent to pre-experiment stratified randomization in large samples?
- ?How does re-randomization (Morgan & Rubin, 2012) reject unbalanced assignments before deploying treatments?
⚡
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.
中文速览与面试要点
解释分层随机化与它何时必要。
在已知的重要协变量层内独立随机化,保证各层内处理/对照平衡;小样本或强预测协变量时必要。
核心要点
- 分层随机化的做法:按一个或多个 实验前 协变量(如地区、设备类型、用户活跃度分位)把样本划分为若干 层(stratum) ,在每层内 独立 进行随机化(保证各层内处理/对照比例符合预期)。 为什么有效 :① 保证平衡 ——若某协变量与指标强相关,完全随机化在小样本下可能产生组间不平衡(如处理组恰好包含更多高活跃用户),分层消除了这种风险;② 降低方差 ——分层估计量 = Σ(层权重 × 层内效应),其方差 ≤ 完全随机化的方差(因为消除了层间差异的贡献),这与 CUPED 的目标一致(都是用协变量降方差)。 何时必要 :① 样本量小 ——随机化本身无法保证平衡时;② 协变量与指标强相关 ——不平衡会显著偏倚结果;③ 需要按层分析 ——如关心不同地区的效应(分层保证每层都有足够样本);④ 分层是业务流程要求 ——如按地区分批上线。
- 实践要点:① 分层 vs 后分层(Post-stratification) ——分层在 随机化时 使用协变量(需在实验前可知);后分层在 分析时 按协变量加权调整(可用于实验后才获得的协变量,如用户历史行为);两者都能降方差,后分层更灵活但需保证各层有足够样本。② 分层 vs CUPED ——两者都降方差但机制不同:分层用于 离散 协变量(层内完全平衡),CUPED 用于 连续 协变量(回归调整);实践中可 叠加 (先分层再 CUPED)。③ 层数的权衡 ——层数多则每层样本少(随机化不平衡风险再现)、分析复杂;通常 2–5 个分层变量、每层至少数百样本。④ 分层的正确性 ——分层变量必须是 实验前 确定的(不能被处理影响),否则会引入偏差;常见错误是用'实验期行为'分层。⑤ 分析 ——分层实验应用 分层估计量 (层内效应按层权重加权),而非简单合并所有样本(后者会引入 Simpson 悖论风险);也可用带层固定效应的回归。⑥ 与分组随机化的区别 ——分层是对 个体 按协变量分组后随机化;集群随机化是对 整组 随机化(处理干扰);两者常结合(分层集群随机化)。
- 保证每层的组间平衡(降低方差)
- 层数过多会导致层内样本过少
常见陷阱
- 用实验期行为做分层变量(引入偏差)
- 分层实验用简单合并分析(丢失分层收益)