Designing and Analyzing a Core Feed Ad-Insertion Experiment
Statistics & ExperimentsModel answerLast updated
Design an A/B test for introducing sponsored video cards into a social feed, addressing metrics, sample size, network interference, multiple testing, and novelty effects.
You are an experimentation data scientist at a social video platform. The product team wants to insert a new sponsored short video format into the primary organic feed. The goal is to generate incremental revenue without harming long-term user retention or daily activity.
Walk through the design, execution, and post-experiment analysis of this change:
Part 1: Experimental Design
- Metric Selection: Pick a primary metric, a guardrail metric, and secondary metrics. Explain why standard ad metrics like Revenue per Mille (RPM) can be misleading when used as a primary assignment-level metric.
- Power & Sample Size Calculation: How do you determine the required sample size per arm if you target a 2% lift in revenue while ensuring you can rule out a 0.5% drop in user active time? Show how you structure the calculation.
- Randomization Strategy & Interference: Compare user-level, cluster-level, and switchback designs. How do you mitigate both social spillover and advertiser auction interference?
Part 2: Statistical Inference & Pitfalls
- Multiple Testing & Guardrail Evaluation: Suppose you track 10 metrics across engagement, ad quality, and revenue. Your primary metric shows a significant gain, but active time shows a borderline drop ($p = 0.048$). How should you handle multiple testing, and how should a guardrail metric be evaluated differently than a superiority metric?
- Novelty & Long-Term Effects: Initial results show a spike in engagement during the first week that decays by week two. How would you quantify and model this novelty effect to estimate steady-state impact?
Part 3: Validation & Diagnostics
- Diagnostics & Cross-Experiment Interference: How do you verify the integrity of the experiment (e.g., sample ratio checks, cross-experiment contamination)? What steps would you take if a Sample Ratio Mismatch (SRM) is detected?
Hints
Hint 1
Ratio metrics like RPM have moving denominators under treatment; consider normalizing per user unit instead.
Hint 2
Guardrail metrics require non-inferiority testing, which flips the burden of proof compared to superiority testing.
Hint 3
Auction interference can be addressed by partitioning advertiser budgets alongside user randomization.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Part 1: Experimental Design
1. Metric Selection
Primary Metric: Average Daily Ad Revenue per User (ARPU_ad)
- Definition: Total ad revenue generated divided by total active users assigned to the arm.
- Why not RPM (Revenue per 1,000 Impressions)? RPM is a ratio metric where both the numerator ( ad revenue) and the denominator (ad impressions) can be shifted by introducing a new ad format. If the new format increases ad load, impressions might jump significantly while total revenue increases slightly—causing RPM to drop even though total business value increased. Conversely, high-value ads might suppress impression counts, inflating RPM while total revenue drops. Evaluating treatment effects on
ARPU_admaintains the user as the unit of analysis, aligning directly with randomized user assignments.
Guardrail Metric: Daily Active Time per User (Minutes/Day)
- Definition: Total active session duration divided by active users.
- Evaluation Framework: Evaluated via a non-inferiority test against a pre-specified tolerance margin $m$ (e.g., $m = -0.5%$). We aim to reject the null hypothesis $H_0: \Delta \le -m$.
Secondary & Diagnostic Metrics:
- Ad Quality & Experience: Hide/report rate, 3-second view rate, video completion rate, organic post scroll depth.
- Advertiser ROI: Conversion rate, Cost Per Action (CPA). Tracking advertiser outcomes ensures revenue gains are not coming from low-quality impressions that cause long-term advertiser churn.
2. Sample Size Calculation
To size the experiment, we compute the required sample size for both the primary metric (superiority) and the guardrail metric (non-inferiority). The metric requiring the larger sample size dictates the total sample size.
Using the standard two-sample Z-test formula for sample size per arm: $$n = \frac{2 \cdot (z_{1 - \alpha/2} + z_{1 - \beta})^2 \cdot \sigma^2}{\delta^2} = \frac{2 \cdot (z_{1 - \alpha/2} + z_{1 - \beta})^2 \cdot (\text{CV} \cdot \mu)^2}{(\text{MDE} \cdot \mu)^2} = \frac{2 \cdot (z_{1 - \alpha/2} + z_{1 - \beta})^2 \cdot \text{CV}^2}{\text{MDE}^2}$$
Where $\text{CV} = \frac{\sigma}{\mu}$ is the coefficient of variation and $\text{MDE}$ is the minimum detectable effect expressed as a relative change.
For $\alpha = 0.05$ (two-tailed, $z_{1 - \alpha/2} = 1.96$) and $80%$ power ($z_{1 - \beta} = 0.84$): $$2 \cdot (1.96 + 0.84)^2 \approx 15.7$$
A. Revenue Lift (Detecting $+2%$ MDE)
- Assume high variance in spend due to heavy-tailed distributions: $\text{CV}_{\text{rev}} = 3.0$.
- $\text{MDE}_{\text{rev}} = 0.02$.
$$n_{\text{rev}} \approx \frac{15.7 \cdot 3.0^2}{0.02^2} = \frac{141.3}{0.0004} \approx 353,250 \text{ users per arm}$$
B. Active Time Guardrail (Detecting $-0.5%$ Non-inferiority Margin)
- Active time has lower relative variance: $\text{CV}_{\text{time}} = 1.5$.
- Non-inferiority threshold: $\text{MDE}_{\text{time}} = 0.005$.
$$n_{\text{time}} \approx \frac{15.7 \cdot 1.5^2}{0.005^2} = \frac{35.325}{0.000025} \approx 1,413,000 \text{ users per arm}$$
Takeaway
The guardrail metric controls the minimum sample size ($1.41\text{M}$ users/arm). Relying solely on powering for the revenue metric would lead to an underpowered guardrail test, risking false confidence when claiming "no significant drop in engagement."
Variance Reduction Techniques
- CUPED (Controlled Experimentation Using Pre-Experiment Data): Regress post-treatment metrics on pre-experiment baseline features (e.g., pre-period average active time). CUPED can reduce variance ($\sigma^2$) by $30%–50%$, proportionally reducing required sample size.
- Winsorization / Trimming: Cap extreme revenue values (e.g., at the 99.9th percentile) to reduce skewness and lower the empirical coefficient of variation.
3. Randomization Unit & Interference Mitigation
When testing features with social interactions or marketplace dynamics, the Stable Unit Treatment Value Assumption (SUTVA) can be violated.
| Strategy | Advantages | Disadvantages / SUTVA Risks |
|---|---|---|
| User-Level | Max statistical power, minimal unit variance, uniform UX per user. | Social Spillover: Users sharing ad content with control users.<br>Auction Interference: Treatment and control compete for the same advertiser budgets in real-time auctions. |
| Cluster-Level (Geos / Graph) | Internalizes social interactions within clusters. | Higher variance, reduced effective sample size ($N = \text{clusters}$), risk of cluster imbalance. |
| Switchback (Time Slices) | Eliminates auction market cannibalization by altering treatment across the platform over time. | User experience flickers; susceptible to carryover/carryforward effects; cannot measure long-term user adaptation. |
Preferred Hybrid Approach:
- User-Level Randomization for User Metrics: Keeps sample size high and user experience consistent.
- Budget-Split (Dual Market Partitioning) for Auction Interference: Split advertiser campaign budgets in the back-end auction proportionally (e.g., 50% to treatment inventory, 50% to control inventory). This prevents the treatment arm from artificially draining shared campaign budgets and altering ad pricing for the control arm.
- Parallel Cluster Check: Run a smaller cluster-randomized sample to calculate the network spillover bias multiplier and validate user-level metrics.
Part 2: Statistical Inference & Pitfalls
4. Multiple Testing & Guardrail Evaluation
A. Multiple Testing Correction Strategy
When monitoring 10 metrics, testing each at $\alpha = 0.05$ leads to a family-wise error rate (FWER) of $1 - (1 - 0.05)^{10} \approx 40%$.
- Confirmatory Metrics (Primary & Guardrail): Use a hierarchical (gatekeeping) testing strategy. Test the primary revenue metric first at $\alpha = 0.05$. Only if revenue lift is statistically significant do you formally test the active time guardrail.
- Exploratory Metrics (Secondary 8 metrics): Apply Benjamini-Hochberg (FDR) control at $q = 0.10$. This guards against false positives while preserving sensitivity for exploratory diagnostics.
B. Evaluating Guardrails (Non-Inferiority vs. Superiority)
Applying standard FWER corrections (like Bonferroni) to guardrail metrics is a common error. Making $\alpha$ stricter for a guardrail makes it harder to reject the null of inferiority, making it easier to incorrectly conclude that a harmful change is safe.
Instead, evaluate the 95% Confidence Interval relative to the non-inferiority margin ($m = -0.5%$):
Non-Inferiority Margin (-0.5%) 0%
| |
Case A: [---|---] | -> Non-inferior (Safe to Launch)
Case B: [-------|-------] | -> Inconclusive (Crosses Margin)
Case C: | [---] | -> Inferior (Do Not Launch)
If active time shows a decrease of $-0.4%$ with $p = 0.048$ and a $95%$ CI of $[-0.78%, -0.02%]$, the CI crosses the non-inferiority threshold of $-0.5%$. Even though the primary revenue metric succeeded, the feature fails the guardrail check and cannot be launched in its current state.
5. Novelty Effect Modeling
Initial user engagement spikes (or drops) often decay as the novel experience wears off.
Metric Lift
^
| * <-- Novelty Spike (Day 1-3)
| *
| *
| * * * * * * * * <-- Steady State (Day 14+)
+--------------------------> Time in Experiment
Analytical Procedure:
- Exposure-Age Alignment: Re-index data by "Days since first exposure" per user, rather than calendar date, to decouple calendar seasonality from exposure decay.
- Parametric Decay Model: Fit an exponential decay function on daily treatment effects: $$\Delta(t) = \Delta_{\infty} + (\Delta_0 - \Delta_{\infty}) \cdot e^{-\lambda t}$$ Where $\Delta_{\infty}$ represents the projected long-term steady-state impact.
- Cohort Comparison Analysis: Compare the effect size on Day 14 of users exposed on Day 1 versus users exposed on Day 10. If the Day 10 cohort shows the same initial spike as Day 1 did, the phenomenon is exposure-driven novelty rather than an exogenous shift.
- Long-Term Holdout: Reserve a small holdout slice (e.g., 1% of traffic) for 30–60 days post-launch to validate that steady-state estimates match predicted values ($\Delta_{\infty}$).
Part 3: Validation & Diagnostics
6. Diagnostics & SRM Troubleshooting
Primary Diagnostics
-
Sample Ratio Mismatch (SRM): Conduct a Pearson Chi-Square Goodness-of-Fit test on observed assignment counts vs expected allocation ratio (e.g., 50/50). $$\chi^2 = \sum \frac{(O_i - E_i)^2}{E_i}$$ Flag any SRM at $p < 0.001$.
-
Pre-Experiment A/A Validation: Run an A/A evaluation using pre-period historical data on the exact assigned arms to confirm that baseline metrics show no statistically significant difference.
SRM Root-Cause Troubleshooting Workflow:
SRM Detected (p < 0.001)
│
├── 1. Check Assignment Pipeline
│ └── Is the hash function evenly distributed across user IDs?
│
├── 2. Segment by Dimensions
│ └── Break down by Platform (iOS/Android), Country, App Version.
│ (e.g., Treatment crashes on old Android versions -> logging drops).
│
└── 3. Examine Filtering & Triggering Rules
└── Are users assigned on exposure (post-triggering) rather than allocation?
(Differential latency between arms can bias exposure logging).
If an SRM is confirmed, all standard statistical inference tests are invalid due to selection bias, and the experiment must be paused and resolved before making launch decisions.