M3-006Hard方差缩减 · Variance reduction

解释 CUPED 的原理,并说明它为什么能降方差、什么时候会失效。

Explain CUPED: why does it reduce variance, and when does it fail?
💡 考场高分一句话答案:

用实验前的同口径指标作协变量,减去其与处理无关的波动;方差缩减比例为 $1-\rho^2$,当 $X$ 与 $Y$ 相关性弱或 $X$ 受处理影响时失效。

It uses a pre-experiment version of the same metric as a covariate and subtracts its treatment-independent variation. Variance falls by $1-\rho^2$, and it fails when correlation is weak or the covariate is measured after randomisation.

📌 核心考察要点 (Key Points)

  • 公式:$\tilde{Y}=Y-\theta(X-\bar X)$,$\theta=\mathrm{Cov}(Y,X)/\mathrm{Var}(X)$
  • 为什么无偏:$X$ 在随机化前测定,$\mathbb{E}[X\mid T]=\mathbb{E}[X]$,故 $\mathbb{E}[\tilde Y\mid T]=\mathbb{E}[Y\mid T]$
  • 降方差:$\mathrm{Var}(\tilde Y)=\mathrm{Var}(Y)(1-\rho^2)$
  • 失效条件:$\rho$ 接近 0;$X$ 在随机化后测定;$X$ 与 $Y$ 的关系在实验期改变(如指标定义变更)
  • Formula: $\tilde{Y}=Y-\theta(X-\bar X)$ with $\theta=\mathrm{Cov}(Y,X)/\mathrm{Var}(X)$
  • Why unbiased: $X$ is measured pre-randomisation so $\mathbb{E}[X\mid T]=\mathbb{E}[X]$, hence $\mathbb{E}[\tilde Y\mid T]=\mathbb{E}[Y\mid T]$
  • Variance: $\mathrm{Var}(\tilde Y)=\mathrm{Var}(Y)(1-\rho^2)$
  • Failure modes: $\rho$ near zero; $X$ measured after randomisation; the $X$–$Y$ relationship shifting during the experiment

📐 第一性原理与数理推导机理

设 $\tilde Y=Y-\theta(X-\mu_X)$,则$$\mathrm{Var}(\tilde Y)=\mathrm{Var}(Y)+\theta^2\mathrm{Var}(X)-2\theta\mathrm{Cov}(Y,X)$$对 $\theta$ 求导置零得 $\theta^*=\mathrm{Cov}(Y,X)/\mathrm{Var}(X)$,代回得 $\mathrm{Var}(\tilde Y)=\mathrm{Var}(Y)(1-\rho^2)$。因此最优 $\theta$ 下,方差缩减完全由相关系数决定。

⚖️ 业务权衡与取舍 (Trade-offs & Calibration)

工业实践中还有一个更强的版本:CUPED with ML——用梯度提升树拟合 $\mathbb{E}[Y\mid X]$,把预测值当协变量。这在 $X$ 高维时能拿到比线性 CUPED 更高的 $\rho$。但要留出交叉拟合(cross-fitting)避免过拟合导致的方差低估。

⚠️ 常见高频面试陷阱与避坑指南

  • 用实验期的指标作 $X$(吸收了处理效应,破坏无偏性)
  • 不做交叉拟合,用同一批数据估 $\theta$ 和算效应

🔍 大厂面试官连环追问 (Follow-ups)

  • 如果 $\rho=0.5$,样本量能省多少?
  • CUPED 与 triggered analysis 能同时用吗?

嫌字多看太累?进入苏格拉底式对话推演实验室

零打字负担,以大厂考官真实困境切入,通过点选直觉选项暴露思维盲区,手把手推导 Why。

💬 开启对话式破冰 ➔
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔