∑GateAndNet
PlannerSign Up
INTERMEDIATECore Topic 4 min read 2 views

A/B Testing Power Analysis, Simpson’s Paradox & Correlation vs Causality Traps

Sample size scaling in online A/B experiments, Bonferroni multiple-testing correction, Pearson linear vs Spearman rank correlation, Anscombe’s quartet, and Simpson’s confounding paradox.

1. Online Controlled Experiments (A/B Testing) & Multiple Comparisons

  • Statistical Power (1−β1 - \beta): Probability of correctly rejecting H0H_0 when a real effect δ≠0\delta \neq 0 exists (standard industry target: α=0.05\alpha = 0.05, Power 1−β=0.801 - \beta = 0.80).
  • Multiple Testing (pp-Hacking) Trap: Testing m=20m = 20 independent metrics at α=0.05\alpha = 0.05 when all null hypotheses are true gives family-wise false positive probability:
P(at least 1 false positive)=1−(1−0.05)20≈0.642  (64.2%)!P(\text{at least 1 false positive}) = 1 - (1 - 0.05)^{20} \approx \mathbf{0.642 \; (64.2\%)}!
  • Bonferroni Correction: Test each individual hypothesis at αadj=α/m\alpha_{\text{adj}} = \alpha / m to guarantee Family-Wise Error Rate FWER≤α\text{FWER} \le \alpha (or use Benjamini-Hochberg to control False Discovery Rate).

2. Classic Correlation & Aggregation Traps

  1. Zero Correlation ≠\neq Independence: XX and YY independent   ⟹  Cov⁡(X,Y)=0  ⟹  rXY=0\implies \operatorname{Cov}(X,Y) = 0 \implies r_{XY} = 0, EXCEPT the converse is FALSE! Example: X∈{−1,0,+1}X \in \{-1, 0, +1\} equally likely and Y=X2  ⟹  E[XY]=E[X3]=0=E[X]E[Y]Y = X^2 \implies \mathbb{E}[XY] = \mathbb{E}[X^3] = 0 = \mathbb{E}[X]\mathbb{E}[Y], so rXY=0r_{XY} = 0 even though YY is 100%100\% determined by XX! (Exception: For Bivariate Normal (X,Y)(X,Y), ρ=0  ⟺  \rho = 0 \iff Independent!)
  2. Pearson (rr) vs Spearman (rsr_s): For strictly monotonic non-linear Y=eXY = e^X, Spearman rank correlation is rs=+1.0r_s = +1.0, whereas Pearson r<1r < 1.
  3. Simpson’s Paradox: A trend present inside every subgroup (AA beats BB in both Easy and Hard patient cohorts) reverses direction when groups are aggregated because a confounder ZZ affects both treatment assignment and base outcome rate!
Key Formulas Summary
Sample Size Scaling for Two-Sample A/B Test (Minimum Detectable Effect delta)
n∝σ2δ2n \propto \frac{\sigma^2}{\delta^2}
Note: Halving the Minimum Detectable Effect (delta -> delta/2) requires 4x as many users per variant!
Pearson Linear vs Spearman Rank Correlation
rXY=Cov⁡(X,Y)σXσY∈[−1,1],rs=1−6∑di2n(n2−1)r_{XY} = \frac{\operatorname{Cov}(X, Y)}{\sigma_X \sigma_Y} \in [-1, 1], \qquad r_s = 1 - \frac{6 \sum d_i^2}{n(n^2 - 1)}
Note: If Y = X^2 on symmetric X ~ Uniform(-1, 1), Cov(X,Y) = 0 => r_XY = 0 despite exact deterministic dependence!
#Data Science#A/B Testing#Statistical Power#Pearson#Spearman#Simpson Paradox

Practice Questions on This Chapter (1)

Q1GATE DA A/B TestingMCQMEDIUM
+2M • -0.67

In an online A/B test with fixed significance α=0.05\alpha = 0.05 and power 1−β=0.801 - \beta = 0.80, you decide to detect a Minimum Detectable Effect (MDE) half as small (δnew=δ/2\delta_{\text{new}} = \delta / 2). How does the required sample size nn per variant change?

⚡ Click an option above to verify instantly
Previous TopicData Science Pipelines: EDA, Feature Scaling, OLAP Schemas & SQL Window FunctionsNext Topic Machine Learning: Bias-Variance, L1/L2 Regularization & Confusion Matrix Metrics