M6-003Hard从零实现统计 · Implement from scratch
比率指标(CTR)的方差怎么算?手写线性化版本。
How do you compute the variance of a ratio metric such as CTR? Write the linearised version.
💡 考场高分一句话答案:
对每个随机化单位计算 $z_u=c_u-\bar r\cdot i_u$,再对 $z$ 做两样本 t 检验;等价于 delta method。
For each randomisation unit compute $z_u=c_u-\bar r\cdot i_u$, then run a two-sample t-test on z. It is equivalent to the delta method.
🧭 Playbook 核心提示 / Actionable Calibration:
为什么这样就对:$\bar z=\bar c-r\bar i$,而 $\frac{\bar c}{\bar i}-r=\frac{\bar c-r\bar i}{\bar i}=\frac{\bar z}{\bar i}$,除以常数 $\bar i$ 不改变 t 统计量。所以对 $z$ 做 t 检验与对 $c/i$ 做 delta method 完全等价。
📌 核心考察要点 (Key Points)
- 为什么不能用二项式:曝光在用户内相关,且分母是随机变量
- 线性化:$z_u=c_u-r\cdot i_u$,$\mathrm{Var}(\bar z)$ 即比率的渐近方差
- 实现要点:按 user 聚合后再算,不要在 impression 级别算
- 与 delta method 的关系:数学等价,线性化更易加 CUPED
- Why not binomial: impressions are correlated within a user and the denominator is itself random
- Linearisation: $z_u=c_u-r\cdot i_u$; the variance of $\bar z$ is the asymptotic variance of the ratio
- Unit: aggregate to user first, never compute at impression level
- Advantage over delta method: mathematically equivalent but trivially composable with CUPED
🔍 大厂面试官连环追问 (Follow-ups)
- 如何在这个框架里加 CUPED?
- 如果分子分母来自不同表,怎么对齐?
嫌字多看太累?进入苏格拉底式对话推演实验室
零打字负担,以大厂考官真实困境切入,通过点选直觉选项暴露思维盲区,手把手推导 Why。
⚡
想检验本题的肌肉记忆?进入 3 阶闪卡主动回忆盲测
隐藏答案遮罩,自测:审题锚点 ➔ 数理公式机理 ➔ 工业标杆代码与连环追问。3 分钟攻破认知盲区!