State the data grain, assumptions, metric, leakage or failure risk, and how you would validate the result before discussing tools.
Question set
9 detailed answers
A recorded source review is available for 2 of 9 answers. Each reviewed answer lists its date and scope.
01How does an A/B test work end to end? Walk through the key steps.
middle
Short answer: An A/B test is a randomized experiment: users are split at random into control and treatment, shown different versions, and compared on a single pre-chosen primary metric under a fixed decision rule.
In depth:
- Hypothesis — what you change, which metric it should move, and why.
- Metric and MDE — one primary metric plus a minimum detectable effect (MDE).
- Randomization — a random, stable split into control/treatment.
- Sample size and duration — compute and fix them before launch.
- Run to N — run until the sample is reached, without peeking at interim results.
- Analysis — compare the metric, compute the p-value and the confidence interval of the lift.
- Decision — ship or roll back per the pre-defined rule.
Hypothesis → Randomize → Run to N → Analyze → Decision
│ │
control / treatment ship ✓ / rollback ✗
⚠️ Common mistake: changing the UI mid-test or stopping the moment it first looks 'significant' — both break the conclusions.
02What determines the sample size and duration of an A/B test, and why do you fix the duration up front?
senior
Short answer: Sample size is driven by the baseline rate, the minimum detectable effect (MDE), power (1−β, usually 80%), and the significance level α (usually 5%): the smaller the MDE, the more data you need. You fix duration up front to rule out peeking and to cover whole weekly cycles.
In depth:
- Baseline rate — rare events have relatively higher variance → need more sample.
- MDE — the strongest lever: sample grows roughly as 1/MDE².
- Power (1−β) — chance of detecting a real effect; 80% is standard.
- α — false-positive threshold; a smaller α means a larger sample.
- Duration — divide N by daily traffic and round up to whole weeks.
# Sample size per group: difference of proportions
from scipy.stats import norm
z_a, z_b = norm.ppf(0.975), norm.ppf(0.80) # α=5% (two-sided), power 80%
p1, p2 = 0.10, 0.11 # baseline 10%, MDE = +1 pp
var = p1*(1-p1) + p2*(1-p2)
n = (z_a + z_b)**2 * var / (p2 - p1)**2
print(round(n)) # ≈ 14,700 per group
⚠️ Common mistake: not fixing duration in advance and 'stopping once it's significant' — that is peeking, which inflates false positives.
03How do you interpret an A/B test result: statistical vs practical significance, and why isn't a non-significant result 'no effect'?
senior
Short answer: Statistical significance means p < α under a prespecified valid procedure: assuming the null hypothesis and test assumptions, data at least as extreme are unlikely. It is not the probability that the effect is “due to chance” or that the null is true. Practical significance asks whether benefits justify costs and risks.
In depth:
- Effect and interval — report the estimate, units, and confidence interval. For a corresponding two-sided 5% test, excluding zero from a 95% interval agrees with rejecting the null; one-sided and adjusted procedures require matching intervals.
- MDE — the effect the design is powered to detect at a specified power and α. It is a planning parameter, not an automatic business-value threshold or a bound on effects excluded by the observations.
- Non-significance — the null was not rejected; limited precision or a small effect are both possible. Do not conclude “we only need more data” or “effects ≥ MDE are absent.” Inspect the values still compatible with the interval.
- Practical decision — prespecify a minimum worthwhile effect and guardrails. To establish the absence of a practically important difference, use an appropriate equivalence design with predefined margins.
For example, a lift interval of [−0.5, +1.8] percentage points includes zero and a meaningful positive effect; it does not justify “there is no effect.”
⚠️ Common mistake: treating p ≥ α as proof of zero effect, or comparing only p-values. Discuss magnitude, uncertainty, design, and business thresholds together.
04What is peeking and why does it inflate the false-positive rate? How do you handle multiple comparisons?
senior
Short answer: Peeking is repeatedly checking significance while the test runs and stopping the moment p < 0.05. Each extra look is another chance at a fluke 'win,' so the real α climbs well above 5%. Many metrics/variants cause the same multiple-comparisons problem and need correction.
In depth:
- Why peeking is dangerous — with many looks, the chance of crossing the threshold at least once approaches 100%.
- How to do it right — fix N and look once; if you need interim looks, use sequential testing / alpha-spending.
- Multiple comparisons — k metrics at α=5% give a risk ≈ 1−0.95^k; apply Bonferroni or control FDR (Benjamini–Hochberg).
| Number of looks | Real false-positive risk (α=5%) |
|---|---|
| 1 | ~5% |
| 2 | ~8% |
| 5 | ~14% |
| 10 | ~19% |
| every day | → approaches 100% |
⚠️ Common mistake: stopping on day one when p happened to dip below 0.05.
05How do you choose metrics for an A/B test: primary vs guardrail vs secondary, and why is 'too many metrics' risky?
middle
Short answer: One primary metric decides the test; guardrail metrics make sure you didn't break something important (revenue, speed, churn); secondary metrics help explain the mechanism. The more 'win' metrics you add, the higher the chance of a fluke significance, so keep the set short.
In depth:
- Primary — chosen in advance, drives the decision; exactly one.
- Guardrail — must not degrade; blocks the ship even if the primary goes up.
- Secondary — for interpretation and hypotheses, not for the decision.
| Type | Role | Example | Decides outcome? |
|---|---|---|---|
| Primary | success criterion | purchase conversion | yes |
| Guardrail | harm protection | latency, revenue, churn, complaints | blocks the ship |
| Secondary | explains mechanism | CTR, session depth | no |
⚠️ Common mistake: loading up a dozen 'win' metrics and declaring success on whichever happened to light up — that's hidden multiple comparisons.
06What threats to validity can affect an A/B test, and what is SRM?
senior
Short answer: Validity is broken by an imbalance in the group split (SRM — sample ratio mismatch), novelty/primacy effects, network effects (treatment affecting control), and seasonality. SRM is a red flag of a broken experiment: don't trust the results until you've found the cause of the discrepancy.
In depth:
- SRM — the actual split differs significantly from the expected one (test with χ²); a sign of a bug in randomization, logging, or filtering.
- Novelty/primacy — response shifts over time: people either poke a novelty out of curiosity or reject it out of habit.
- Network effects — groups aren't isolated (social, marketplaces), the effect 'leaks.'
- Seasonality — day of week, promos, holidays distort short tests.
| Threat | The problem | Mitigation |
|---|---|---|
| SRM | split ≠ expected | χ²-test up front; don't analyze until fixed |
| Novelty/primacy | effect drifts over time | run longer, watch the daily trend |
| Network effects | groups influence each other | cluster/geo randomization |
| Seasonality | external cycles | full weekly cycles, don't cut short |
⚠️ Common mistake: seeing a 'significant' result and not checking SRM — with skewed groups the comparison is invalid to begin with.
07How do you correctly read a segmented A/B test result, and what is Simpson's paradox?
middle
Short answer: An aggregate result can flip inside segments (Simpson's paradox) when segments differ a lot in size and respond differently. But slicing after the fact into dozens of segments is hidden multiple comparisons: something 'significant' will turn up by chance.
In depth:
- Simpson's paradox — the effect's direction in every segment is opposite to the total because of an imbalanced split across groups (often a symptom of SRM).
- Slicing to significance — the more cuts, the higher the chance of a false discovery; fix decision segments in advance.
- What to do — pre-register key segments; treat the rest as hypothesis generation, not a conclusion.
| Segment | Control | Treatment |
|---|---|---|
| Mobile | 8% (8/100) | 9% (90/1000) |
| Desktop | 30% (300/1000) | 33% (33/100) |
| Total | 28% (308/1100) | 11% (123/1100) |
Treatment wins in each segment yet loses overall: the groups are skewed across platforms.
⚠️ Common mistake: slicing the data until some segment shows p < 0.05 and passing that off as the result.
08When user-level randomization is unsuitable, how do switchback, geo experiments, and quasi-experiments differ?
senior
Short answer: Inability to randomize individual users does not rule out a randomized experiment. Switchback designs can randomly assign treatment to time blocks, and geo tests can randomize regions. Difference-in-differences and synthetic control usually use observational comparisons and need additional assumptions for causal interpretation.
In depth:
| Method | Idea | Main conditions |
|---|---|---|
| Randomized switchback | randomly assign treatment to time blocks, sometimes within regions | account for carryover, washout, and dependence between nearby blocks |
| Randomized geo/cluster test | randomly assign regions/clusters | enough clusters; analysis matches the randomization unit; assess spillovers |
| Difference-in-differences | compare test/control changes before and after | parallel counterfactual trends, no related interventions or anticipation |
| Synthetic control | build a weighted control from other units | suitable donors, good pre-treatment fit, and uncontaminated controls |
- Identify the assignment unit and randomization scheme first. The name “switchback” or “geo holdout” does not by itself establish randomization.
- Network effects and effects persisting over time can violate independence; washout reduces but does not automatically eliminate carryover.
- Do not treat every user as an independent unit when assignment is by region or time block. Uncertainty must account for the design.
⚠️ Common mistake: calling every alternative to user-level A/B a quasi-experiment. Distinguish randomization from observational identification and justify the causal claim through specific assumptions.
09Why does a randomized experiment establish causation where observational analysis can't, and what's the price of that rigor?
middle
Short answer: Randomization, on average, balances the groups on all factors — known and unknown — so the difference in the metric can be attributed to the change itself, not to hidden confounders. Observational analysis can't do this: correlation ≠ causation. The price of that rigor is time, traffic, and engineering effort.
In depth:
- Confounder — a shared factor Z that affects both the 'feature' X and the metric Y, creating a spurious link.
- Randomization removes it — random assignment cuts the Z→X link, balancing Z across groups.
- Observationally — Z is uncontrolled; the visible X–Y link may be entirely due to Z.
- The price — you need sample, weeks of waiting, and infrastructure for a correct split.
Observational: Z (confounder)
↙ ↘
X ······?······ Y link may run through Z
Randomized: coin flip → X Z balanced across groups
↘
→ Y the X→Y arrow is 'clean'
⚠️ Common mistake: drawing causal conclusions from observational correlations without closing confounders via randomization or at least controls.
Source notes
References and review policy
Source links provide further reading. Where a recorded technical review is available, the answer shows its date and scope. Tool selections use direct provider links and contain no affiliate placements. Sources, features, and hiring formats can change.
From reading to recall
Practice the full interview loop.
RecallDeck schedules the concepts you miss and keeps coding, design, and behavioral fundamentals available when the interviewer changes direction.