Interview Prep · Statistics & Experimentation

The Statistics & Experimentation Field Guide

A working-knowledge reference on the statistical-reasoning half of data science interviews: hypothesis testing and estimation done rigorously, how to design and run an A/B test that survives scrutiny, the pitfalls that trip up even experienced practitioners, and the causal-inference toolkit for the (common) case where you simply can't randomize.

11 sections · 27 interview Q&A · updated 2026
Section 01

Overview & Mental Model

What this guide covers, why it's tested so heavily, and how it differs from the "which algorithm" half of a DS interview.

Most senior data-scientist interviews split roughly into two halves: modeling (which algorithm, how does it work, how do you tune it) and statistical reasoning (can you trust the number you just produced, and can you design a study that produces a trustworthy one in the first place). The second half is where more senior candidates are actually differentiated — anyone can call scipy.stats.ttest_ind, but far fewer can say precisely what the p-value it returns does and doesn't mean, design a test with adequate power before running it, or explain why a metric moved when the company couldn't randomize at all.

Why interviewers lean on this

  • It's hard to fake — surface-level familiarity with "p < 0.05" collapses under one follow-up question.
  • It's directly the job at any company with a mature experimentation platform (most tech companies with real traffic).
  • It reveals whether you think about decisions (ship / iterate / kill) rather than just point estimates.
  • It transfers cleanly to GenAI work: offline eval design, human-eval statistics, and online A/B tests for a new model or prompt are the same toolkit applied to a new outcome variable.

The mental model to anchor on

  • Estimand — the true quantity you want to know (e.g. the population effect of a feature on retention).
  • Estimator — the formula/procedure you use to guess it from data (e.g. a difference in sample means).
  • Uncertainty — how far your estimate could plausibly be from the estimand, given sampling noise (a p-value, a confidence interval, a posterior).
  • Identification — the assumption that lets you claim the estimate reflects a causal effect, not just a correlation (randomization, or one of the causal-inference conditions in Section 6).
Why this matters for interviews

Interviewers rarely want the textbook definition read back to them — they want to see you reason from first principles under a follow-up ("okay, but what if the variance differs by group?" / "what if you can't randomize here?"). Practice explaining each concept in one plain-English sentence before you practice the formula; the formula is easy to look up, the intuition is what gets tested live.

Section 02

Core Statistical Inference

Hypothesis testing, p-values, confidence intervals, and the distributions underneath them — precisely, not just as ritual.

Population vs. sample

Almost every question in this section is really the same question: you observe a sample (finite, noisy, in front of you) and want to say something true about a population (the thing you actually care about, which you can't fully observe). A parameter (e.g. the true population mean μ) is fixed but unknown; a statistic (e.g. the sample mean x̄) is what you compute, and it varies from sample to sample — that variability is the entire reason inferential statistics exists.

The Central Limit Theorem — why it's the load-bearing wall

The CLT states that the sampling distribution of the mean of a sufficiently large number of i.i.d. random variables approaches a Normal distribution, regardless of the shape of the underlying distribution — as long as that distribution has finite variance. This is why t-tests and z-tests on metrics like revenue-per-user (which are themselves wildly non-Normal, often zero-inflated and right-skewed) are still valid at typical A/B-test sample sizes: you're not assuming the raw data is Normal, you're relying on the sampling distribution of the mean being approximately Normal.

Interview trap

"Large enough" for the CLT to kick in depends on how skewed the underlying distribution is. A metric with extreme outliers (e.g. B2B revenue with a few whale accounts) can need a much larger sample than intuition suggests before the Normal approximation is trustworthy — this is exactly why experimentation platforms often cap or winsorize metrics, and why non-parametric or bootstrap alternatives exist for the genuinely pathological cases.

Common distributions and where they show up

DistributionModelsShows up in
Bernoulli / BinomialA single yes/no trial; the count of successes over n trialsConversion rate, click-through rate, any binary metric
Normal (Gaussian)Sums/averages of many small independent effectsSampling distribution of means (via CLT), z-tests
PoissonCounts of rare events in a fixed windowSupport tickets per day, error counts, arrivals
Student's tLike Normal but heavier tails; used when population variance is unknown and estimated from a (often small) samplet-tests on sample means
ExponentialTime between Poisson events; memorylessTime-to-churn, time-between-purchases
Log-normalA variable whose log is Normal — right-skewed, always positiveRevenue per user, session duration, latency
BetaA distribution over probabilities in [0,1]; conjugate prior for Bernoulli/BinomialBayesian A/B testing on conversion rates

Hypothesis testing, precisely

The frequentist hypothesis-testing recipe: state a null hypothesis H0 (typically "no effect," e.g. treatment mean = control mean) and an alternative H1; pick a significance level α (the false-positive rate you're willing to tolerate if H0 is actually true, conventionally 0.05); compute a test statistic from the data; convert it to a p-value; reject H0 if p < α.

Say this precisely, every time

The p-value is the probability of observing a test statistic at least as extreme as the one you got, assuming the null hypothesis is true. It is not: the probability that H0 is true; the probability that your result is due to chance; or the probability that H1 is true. It says nothing at all about the size or practical importance of an effect — a p-value of 0.001 on an effect too small to matter is a correctly detected, practically useless result, common at very large sample sizes.

Type I vs. Type II error

Type I error (α). Rejecting H0 when it's actually true — a false positive; shipping a feature that does nothing. Type II error (β). Failing to reject H0 when H1 is actually true — a false negative; killing a feature that actually worked. Power is 1−β, the probability of correctly detecting a real effect of a given size.

Confidence intervals, precisely

A 95% CI means: if you repeated the sampling and estimation procedure many times, 95% of the intervals constructed this way would contain the true parameter. It does not mean "there's a 95% probability the true value is in this specific interval" — once computed, a specific interval either contains the parameter or it doesn't; the 95% describes the long-run procedure, not this instance.

Choosing a test

TestUse whenCompares
Two-sample t-testComparing means of two groups, variance unknownContinuous metric, e.g. revenue per user
Welch's t-testSame, but variances differ between groups (the safer default — don't assume equal variance)Continuous metric, unequal variance
Paired t-testSame subjects measured twice (before/after)Within-subject change
Z-test for proportionsComparing two conversion rates at large nBinary metric, e.g. click-through rate
Chi-square testAssociation between two categorical variablesCounts in a contingency table
ANOVAComparing means across 3+ groups at onceContinuous metric, multiple arms
Mann-Whitney UNon-parametric alternative when Normality is implausible even asymptotically, or data is ordinalRank-based comparison of two groups
BootstrapNo closed-form standard error, weird metric (e.g. a ratio or a percentile)Resampling-based CI for anything

Misconceptions worth pre-empting

"Not significant" ≠ "no effect"

A p-value above 0.05 means the test was inconclusive at your sample size, not that you've proven the null. An underpowered test that fails to reject H0 tells you almost nothing about whether a real effect exists.

Statistical vs. practical significance

At large enough n, essentially any nonzero effect becomes statistically significant. The interview-ready move is to always pair a p-value/CI with the effect size and ask "is this big enough to act on?"

Section 03

Experiment Design

Randomization, power analysis and sample size, and the variance-reduction techniques that let you ship decisions faster.

Fig. 1 — Everything upstream of "run" (hypothesis, metrics, sample size, randomization unit) has to be locked before you see any data; changing it afterward is how p-hacking happens even with good intentions.

Choosing a randomization unit

The default is the user (via a stable ID or cookie), because most product effects are experienced per-user and users are the thing you want the effect to generalize to. But the right unit depends on where the treatment "acts": a pricing change in a two-sided marketplace may need a geo or market as the unit; a ranking-algorithm change with spillovers between similar users may need a cluster of related users; a supply-side change on a delivery platform may need a time-region cell (a switchback). See Section 5 for why.

Power analysis and sample size

Before running anything, solve for the sample size that gives you an acceptable chance of detecting a real effect of a size you actually care about. For a two-sample comparison of means with equal variance and equal group sizes, the standard closed-form approximation is:

sample size — two-sample mean comparisonformula
n per arm ≈ 2 · (z_(α/2) + z_β)² · σ² / δ²

  σ²  = variance of the metric
  δ   = minimum detectable effect (MDE), in the metric's own units
  z_(α/2) = 1.96 for two-sided α = 0.05
  z_β   = 0.84 for 80% power (0.842), 1.28 for 90% power

For a binary metric (conversion rate), swap in the Binomial variance p(1−p) for σ², using your baseline rate for p. See Section 8 for a fully worked numeric example.

MDE — minimum detectable effect

The smallest true effect size you want the test to be able to detect with your target power. Setting MDE too small (chasing tiny effects) blows up the required sample size and runtime; setting it too large means you'll ship changes with real — just undetected — negative effects on your metric.

The four knobs, and the trade-off

Sample size trades off against α (tighter → more n), power (higher → more n), effect size (smaller MDE → more n), and baseline variance (noisier metric → more n). You control none of these after the fact — which is exactly why variance reduction, below, is so valuable: it shrinks σ² without touching anything else.

Variance reduction: CUPED and friends

CUPED (Controlled-experiment Using Pre-Experiment Data), introduced by Microsoft's experimentation platform team in 2013, is the standard technique for cutting an experiment's required runtime without changing its sample size or its statistical guarantees. The idea: if you have a pre-experiment covariate X correlated with your outcome metric Y (classically, the same metric measured in the weeks before the experiment started), you can subtract out the part of each unit's outcome that was predictable from that covariate before treatment even happened — noise that had nothing to do with the treatment effect you're trying to measure.

CUPED adjustmentformula
Y_cuped = Y − θ · (X − X̄)

  θ = Cov(Y, X) / Var(X)      ← estimated from pre-experiment / control data
  X̄  = mean of the covariate across the whole experiment

Variance reduction ≈ ρ², where ρ = Corr(X, Y)
  e.g. ρ = 0.6  →  ∼36% variance reduction  →  ∼36% less required runtime

Because Y_cuped is an unbiased estimator with strictly lower variance than the raw difference in means (when θ is estimated correctly), it directly shortens how long you need to run a test to hit your target power — teams commonly report needing roughly half the sample size for metrics with a strongly predictive pre-period covariate. Related/adjacent techniques: stratification (block randomization on a known covariate like country or platform, then analyze within strata) reduces variance from imbalance the same randomization draw could otherwise create; CUPAC (Control Using Predictions As Covariates) generalizes CUPED by using an ML model's prediction as the covariate instead of a single raw pre-period metric, capturing more of the predictable variance when one covariate isn't enough; and simple regression adjustment (including pre-period covariates as controls in a linear model of the outcome) achieves a similar effect and is checked less by name but is mathematically closely related to CUPED.

Why this matters for interviews

"How would you speed up this experiment without just adding more users?" is a very common senior-level follow-up, and CUPED is the expected answer. Be ready to explain why it works (removing predictable pre-treatment noise, not the treatment effect itself) rather than reciting the formula — and to note the catch: it needs a covariate that's genuinely predictive and measured strictly before randomization, or you risk conditioning on something affected by treatment.

Section 04

A/B Testing in Practice

The pitfalls that separate "ran a t-test" from "ran a trustworthy experiment" — the part of the interview that tests scar tissue, not textbooks.

Metric selection: OEC and guardrails

OEC / primary metric

Overall Evaluation Criterion. The single metric (or small weighted composite) the ship decision hinges on — chosen and locked before the experiment runs, ideally a metric with a defensible causal link to long-term value, not just whatever moved.

Guardrail metrics

Metrics that must not regress, even if the OEC improves — page-load latency, crash rate, unsubscribe rate, revenue. A guardrail breach can veto a statistically significant OEC win.

Secondary / diagnostic metrics

Metrics you look at to understand why the OEC moved (or didn't) — useful for debugging and for generating the next hypothesis, but not for the ship/no-ship decision itself.

Novelty and primacy effects

A novelty effect is a treatment effect that's inflated early on simply because the change is new and attracts attention (a new UI element gets clicked because it's unfamiliar, not because it's better) and decays over the run. A primacy effect is roughly the opposite: users take time to adjust to a change (a redesigned nav initially hurts engagement purely through unfamiliarity, and the true effect only appears once users re-learn the interface). Both mean the effect you'd measure on day 1 can differ systematically from the steady-state effect — the standard mitigation is running long enough to look at the trend of the effect over time (does it stabilize?), and/or segmenting on new vs. returning users, since only returning users experience novelty/primacy at all.

The peeking problem and sequential testing

A fixed-horizon test's p-value is only valid at the sample size you pre-committed to. Checking results daily and stopping the moment p first dips below 0.05 inflates your true false-positive rate dramatically — repeated significance testing during continuous monitoring can push the effective α from a nominal 5% to well over 20–40% over a multi-week test, because you're implicitly running many correlated tests and taking the best (most extreme) one.

Interview trap

The naive fix candidates often propose — "just check less often" — reduces but doesn't eliminate the problem, and it's an awkward answer because it directly trades off against the very real business need to catch a badly broken experiment early. The industry-standard fix is a different statistical framework, not a discipline problem.

Modern experimentation platforms solve this with sequential testing methods designed to be valid at any stopping time, not just one pre-committed sample size:

Always-valid p-values / mSPRT

Based on a mixture sequential probability ratio test — the p-value (and CI) is constructed so it maintains its nominal false-positive rate under continuous monitoring, no matter how many times or when you look. Statsig and similar platforms report false-positive rates near the nominal level (e.g. ~0.2–0.4% for a 5% test) under continuous peeking with this approach, versus 20%+ for naive repeated z-tests.

Group sequential designs

Pre-specify a small number of "looks" (e.g. 4 interim analyses) with an alpha-spending function (O'Brien-Fleming or Pocock) that allocates a shrinking significance budget across looks so the cumulative Type I error stays at α. Common in platforms that favor a small number of planned checkpoints over continuous monitoring.

The trade-off is real, not free: sequential designs generally need to run to a larger maximum sample size to match a fixed-horizon test's power, and produce wider confidence intervals for a decision made early. The practical pattern reported by teams running both: use sequential testing for fast regression detection / early kill decisions on the primary metric, and still let the full-duration fixed-horizon analysis drive the final, high-confidence ship decision across all metrics.

Multiple comparisons

Testing many metrics (or many variants, or many segments) against the same α multiplies your chance of at least one false positive. With 20 independent metrics tested at α = 0.05, the probability of at least one false "win" by chance alone is 1 − 0.95²⁰ ≈ 64%. Standard corrections: Bonferroni (divide α by the number of tests — simple, conservative, controls family-wise error rate) and the Benjamini-Hochberg procedure (controls the false discovery rate — the expected proportion of false positives among rejected hypotheses — less conservative and generally preferred when you're scanning many secondary/diagnostic metrics rather than making one binary ship decision).

Simpson's paradox

An effect can reverse direction when data is aggregated versus broken out by a subgroup — most often caused by an uneven mix of subgroups between arms. Classic experimentation example: Variant B has a higher conversion rate than A on both mobile and desktop individually, yet a lower conversion rate overall, because B happened to get disproportionately more mobile traffic (which converts lower for structural reasons unrelated to the treatment) and disproportionately less desktop traffic.

SegmentA: conversions/usersA rateB: conversions/usersB rate
Desktop450 / 1,00045.0%95 / 20047.5%
Mobile40 / 20020.0%220 / 1,00022.0%
Overall490 / 1,20040.8%315 / 1,20026.3%

B wins on every segment individually but loses overall, purely from the mix shift — this is exactly why sample ratio mismatch (SRM) checks and pre-registered stratified randomization matter: a healthy randomization should keep the segment mix balanced across arms so this can't happen from the assignment mechanism itself.

Ratio metrics and the delta method

Metrics like "clicks per session" or "revenue per visitor" are ratio metrics — a ratio of two random variables that are correlated with each other at the unit level (a user with more sessions likely also has more clicks). Treating the ratio's variance as if numerator and denominator were independent understates the true variance and inflates false positives. The standard fix is the delta method, a first-order Taylor-series approximation that derives the correct variance of a ratio (or any smooth function of two correlated random variables) from the variances and covariance of the numerator and denominator — most experimentation platforms compute this automatically for any metric declared as a ratio rather than requiring each analyst to derive it by hand.

Sample ratio mismatch (SRM)

If you randomized 50/50 but observe, say, 48.5%/51.5% at a large sample size, that's not noise — a chi-square goodness-of-fit test on the arm sizes will flag it, and it's a strong signal that something in the assignment or logging pipeline is broken (a bot filter, a redirect bug, or differential logging between arms). Never trust the metric results of an experiment with a significant SRM — the imbalance almost always means the two arms aren't comparable populations to begin with, which breaks the entire causal argument the test depends on.

Section 05

Interference & Network Effects

What happens when the treatment given to one user leaks into the outcome of another — the assumption every t-test silently makes, and marketplaces routinely break.

SUTVA

The standard analysis of a randomized experiment relies on SUTVA — the Stable Unit Treatment Value Assumption — which says one unit's outcome depends only on its own treatment assignment, not on which arm any other unit landed in. In a two-sided marketplace, a social feed, or any system with shared, finite resources, this is frequently false: giving one rider a cheaper price can pull drivers away from a nearby rider in the control group; showing one user a new feed-ranking algorithm changes what content other users end up seeing too.

Marketplace / supply-sharing interference

Treatment and control units compete for the same limited resource (drivers, delivery couriers, ad inventory, warehouse capacity). A change in the treatment arm's demand can visibly shift outcomes in the control arm purely through resource contention — biasing the estimated effect, usually toward zero, sometimes in the wrong direction.

Social / network interference

Treatment and control units are connected (friends, followers, teammates) and outcomes spread along those edges — a viral feature shown only to treated users still reaches control users through shares, messages, or visible activity from their treated connections.

Mitigations

You generally can't eliminate interference, only choose a randomization unit that contains most of it within one arm:

Cluster randomization

Randomize a whole connected group (a friend group, a city, a warehouse's customer base) into the same arm together, so interference happens mostly within a cluster rather than across arms. Airbnb's pricing experiments are a well-known industry example of geo/market-level cluster randomization used specifically to reduce marketplace interference bias.

Switchback experiments

Instead of randomizing units, randomize time windows within each region — e.g. a delivery market alternates between treatment and control every few hours. Used at companies like DoorDash specifically because the "unit" that matters (the courier fleet) is shared and can't be cleanly split into two static populations.

Ego-cluster / graph clustering

For social-network products, cluster users into densely-connected groups first (so most of each user's connections land in the same cluster), then randomize at the cluster level — reduces, though rarely eliminates, cross-arm spillover.

The trade-off to name explicitly

Every interference mitigation reduces bias by increasing the effective randomization unit — and power depends on the number of clusters, not the number of underlying users, so a switchback or cluster design with the same total traffic has meaningfully less statistical power than user-level randomization. DoorDash's engineering team has described this explicitly as a three-way trade-off between minimizing interference bias, capturing longer-run "learning" effects, and retaining enough power to detect anything at all — there is no design that maximizes all three simultaneously, and naming that trade-off out loud is itself a strong interview answer.

Section 06

Causal Inference Beyond Randomization

What to reach for when you can't run an A/B test — a launch to everyone at once, a pricing change with legal constraints, a policy already in effect before you were hired.

Fig. 2 — Randomization is always the first choice; every method below it substitutes a specific, unverifiable assumption for the guarantee randomization gives you for free.

Difference-in-differences (DiD)

Compares the change in outcomes over time between a treated group and an untreated comparison group, rather than comparing levels: DiD = (Y_treated,after − Y_treated,before) − (Y_control,after − Y_control,before). This differences away any fixed, time-invariant gap between the groups (treated cities might just always have higher revenue) — what it can't difference away is a trend that differs between groups for reasons unrelated to treatment.

Key assumption

Parallel trends — absent treatment, the treated and control groups would have moved in parallel. Not directly testable (it's a counterfactual), but you build confidence by plotting both groups' pre-treatment trends and checking they track closely.

Typical use

A policy or feature rolled out to some markets/cohorts but not others, with data available both before and after the rollout — e.g. a new checkout flow launched in three cities without a randomized holdout.

Synthetic control

When there's only one treated unit (one city, one country, one large account) and no single untreated unit is a good comparison, construct a weighted composite of several untreated units chosen so the composite's pre-treatment trajectory closely tracks the treated unit's. The gap between the treated unit and its synthetic counterpart after treatment is the estimated effect. Popularized in economics for large single-unit policy changes; the tech-industry analogue is a feature or pricing change launched in a single metro area, matched against a synthetic composite built from similar untreated metros on pre-period order volume, session behavior, and demographics.

Instrumental variables (IV)

Used when treatment assignment is confounded (people who chose the treatment differ systematically from those who didn't) but you have an instrument — a variable that affects the outcome only through its effect on treatment uptake, and is otherwise unrelated to the outcome. Estimated via two-stage least squares (2SLS): regress treatment on the instrument to get predicted treatment, then regress the outcome on that predicted treatment.

Key assumptions

Relevance — the instrument must actually move treatment uptake meaningfully (a "weak instrument" produces unreliable, high-variance estimates). Exclusion restriction — the instrument affects the outcome only through treatment, never directly — unverifiable statistically, must be argued substantively.

What it actually estimates

The Local Average Treatment Effect (LATE) — the effect specifically for "compliers," the subpopulation whose treatment status the instrument actually shifts — not necessarily the average effect across everyone.

Regression discontinuity (RDD)

Applies when treatment is assigned by a sharp cutoff on some continuous "running variable" — a credit-score threshold for a loan offer, a usage threshold for a feature unlock. Units just above and just below the cutoff are assumed to be nearly identical in every way except treatment status, so comparing outcomes in a narrow window around the cutoff approximates a local randomized experiment. The estimate is inherently local — it's the effect near the threshold, which need not generalize to units far from it.

Propensity score matching (PSM)

Estimates each unit's propensity score — P(received treatment | observed covariates X), typically via logistic regression — then matches treated units to untreated units with similar propensity scores (or reweights by the inverse propensity score) to construct a comparison group that looks similar on observed characteristics. Its critical, unverifiable assumption is unconfoundedness / ignorability: that there's no unobserved variable driving both treatment selection and the outcome. PSM can only balance what you measured — it offers no protection against confounders you didn't collect data on, which is the standard critique to raise unprompted in an interview.

MethodNeedsLoad-bearing assumptionEstimates
Diff-in-diffPanel data, treated + control groupsParallel trendsAverage treatment effect on treated
Synthetic controlOne treated unit, many donor units, long pre-periodComposite matches pre-trend closelyEffect on the single treated unit
Instrumental variablesA relevant, excludable instrumentExclusion restrictionLocal average treatment effect (compliers)
Regression discontinuityA sharp assignment thresholdNo manipulation of the running variable at the cutoffLocal effect near the cutoff
Propensity score matchingRich covariates on both groupsUnconfoundedness (no hidden driver)Average treatment effect (on observables)
Section 07

Bayesian vs. Frequentist Framing

Two different answers to "what does probability mean here" — and why most mature experimentation platforms quietly support both.

Frequentist

Probability = long-run frequency over repeated sampling. The parameter is fixed (unknown, not random); the data is random. A p-value/CI describes what would happen if you repeated the same experiment many times. No prior beliefs are incorporated — every experiment is analyzed on its own evidence.

Bayesian

Probability = degree of belief. The parameter is treated as a random variable with a prior distribution, updated by the observed data via Bayes' rule into a posterior distribution. You can then ask direct, decision-relevant questions the posterior answers naturally, like "what's the probability B beats A?"

Bayesian A/B testing in practice

A common industry pattern for a binary metric: put a Beta prior on each arm's conversion rate (Beta is the conjugate prior for a Binomial likelihood, so the posterior is also Beta in closed form — no MCMC required for this simple case), observe conversions, and read off the posterior directly. This gives you outputs many stakeholders find more intuitive than a p-value: P(B > A) — the direct probability the treatment is actually better, and expected loss — the expected cost of choosing wrong, which can drive a stopping rule (stop once the expected loss from picking either arm drops below a threshold you're comfortable with) without the peeking-inflation problem frequentist fixed-horizon tests have.

FrequentistBayesian
Outputp-value, confidence intervalPosterior distribution, P(B>A), credible interval
InterpretationIndirect — about the sampling procedureDirect — about the parameter itself, often more intuitive for stakeholders
Prior knowledgeNot incorporatedExplicitly incorporated (and must be justified/disclosed)
Continuous monitoringRequires a sequential-testing correction (Section 4)Naturally supports monitoring via expected-loss stopping rules
Main criticismP-values are widely misinterpreted; arbitrary α = 0.05 conventionPrior choice is a subjective lever that can be (mis)used to nudge results
Why this matters for interviews

Don't frame this as "which is correct" — a strong senior answer is that they're both valid, answer different questions, and most production experimentation platforms (internal ones at big tech companies, and commercial ones) support both under the hood, often converging numerically at large sample sizes with weak/flat priors. Know one concrete practical reason to prefer each: Bayesian for stakeholder-facing "probability we're right" framing and natural early-stopping; frequentist for a standardized, audit-friendly decision rule across thousands of experiments run by people with varying statistical sophistication.

Section 08

Worked Examples

The calculations you should be able to walk through on a whiteboard, not just cite.

1. Sample size for a conversion-rate test

Baseline conversion rate p0 = 8%. You want to detect a relative lift of 10% (an absolute MDE of δ = 0.8 percentage points, to p1 = 8.8%), at α = 0.05 (two-sided) and 80% power.

power_analysis.pyPython
from scipy.stats import norm
import math

p0, p1 = 0.08, 0.088          # baseline and target conversion rate
alpha, power = 0.05, 0.80

z_alpha = norm.ppf(1 - alpha / 2)   # 1.96
z_beta  = norm.ppf(power)           # 0.8416

p_bar = (p0 + p1) / 2
sigma2 = 2 * p_bar * (1 - p_bar)    # pooled variance term for two-proportion test

n_per_arm = ((z_alpha + z_beta) ** 2) * sigma2 / (p1 - p0) ** 2
print(round(n_per_arm))             # ≈ 18,340 users per arm

At ~18,340 users per arm, you'd need roughly 36,700 users total. If daily eligible traffic is 5,000 users, that's about 7-8 days to reach the full sample — the number you'd quote when someone asks "how long will this experiment take to run?"

2. Interpreting a real p-value / CI result

An experiment reports: control conversion 8.00%, treatment conversion 8.55%, difference +0.55pp, 95% CI [+0.02pp, +1.08pp], p = 0.041.

The precise, interview-safe interpretation

"If there were truly no effect, we'd see a difference this large or larger only 4.1% of the time — below our 5% threshold, so we reject the null of no effect. The 95% CI of [+0.02pp, +1.08pp] means that if we repeated this experiment many times, 95% of the intervals constructed this way would contain the true effect; because the interval excludes zero, that's consistent with rejecting the null." I would not say "there's a 95.9% chance the true effect is positive" (a Bayesian-flavored claim a frequentist CI doesn't license) or "we've proven the treatment works" (a single significant result is evidence, not proof) — and I'd flag that the CI's lower bound is barely above zero, so this is a real but fragile win worth a confirmatory look before a large rollout.

3. CUPED variance reduction, worked

Same experiment as above, but you have each user's conversion rate over the 4 weeks before the experiment as covariate X, and it's correlated with the in-experiment outcome Y at ρ = 0.5.

cuped_example.pyPython
rho = 0.5
variance_reduction = rho ** 2          # 0.25 → 25% reduction in outcome variance
runtime_reduction = variance_reduction  # roughly proportional at fixed power/MDE

# From worked example 1: 18,340 users/arm without CUPED
n_cuped = 18340 * (1 - variance_reduction)
print(round(n_cuped))                   # ≈ 13,755 users per arm

# at 5,000 users/day eligible traffic:
# without CUPED: ~36,700 / 5,000 ≈ 7.3 days
# with CUPED:    ~27,510 / 5,000 ≈ 5.5 days

A modest ρ = 0.5 pre-period correlation buys back roughly two days of runtime on this experiment — the pitch you'd make to a stakeholder asking "can we ship faster" without touching α, power, or the MDE they actually care about.

Section 09

Interview Questions

Grouped by area. Click to reveal a model answer — say your own version out loud before reading mine.

Core inference

inferenceIn plain language, what does a p-value actually mean?

The probability of seeing a result at least as extreme as what you observed, if the null hypothesis were actually true. It is not the probability the null is true, not the probability your result is "due to chance" in some vaguer sense, and it says nothing about effect size or practical importance on its own.

inferenceWhat's the correct interpretation of a 95% confidence interval?

If you repeated the sampling and estimation procedure many times, 95% of the intervals constructed that way would contain the true parameter. It is not "there's a 95% chance the true value is in this specific interval" — the true value is fixed; the interval is the random quantity, and once computed, it either contains the parameter or it doesn't.

inferenceExplain Type I and Type II error, and how they trade off.

Type I (α) is a false positive — rejecting a true null, e.g. shipping a feature that does nothing. Type II (β) is a false negative — failing to reject a false null, e.g. killing a feature that actually worked. For fixed sample size, tightening α (fewer false positives) increases β (more false negatives) — the only way to reduce both simultaneously is more data or a less noisy metric.

inferenceWhy does the Central Limit Theorem let you run a t-test on a heavily skewed metric like revenue?

The t-test's validity depends on the sampling distribution of the mean being approximately Normal, not on the raw data being Normal. The CLT says the mean of enough i.i.d. samples from almost any finite-variance distribution converges to Normal — so at typical A/B test sample sizes the test is still valid even though individual revenue values are wildly skewed. The caveat is "enough" scales with how extreme the skew/outliers are.

inferenceYour test comes back "not significant." What can and can't you conclude?

You can conclude the test was inconclusive at your sample size and MDE — you cannot conclude there's no effect. A non-significant result from an underpowered test is uninformative; the first question to ask is whether the test even had adequate power to detect an effect of a size you'd care about.

Experiment design

designWalk me through how you'd size an A/B test.

Pick the primary metric and its baseline mean/variance (or baseline rate, for a proportion); decide the minimum effect size (MDE) worth detecting given the business context; pick α (usually 0.05) and power (usually 80%); plug into n ≈ 2(z_α/2 + z_β)²σ²/δ²; convert to a runtime given expected daily eligible traffic. Then sanity-check: is that runtime acceptable, and if not, can variance reduction (CUPED) or a larger MDE bring it down without compromising the decision you actually need to make?

designWhat is CUPED and why does it work?

Controlled-experiment Using Pre-Experiment Data — it adjusts each unit's outcome by subtracting off the part predictable from a pre-experiment covariate (e.g. the same metric's value before the experiment started): Y_cuped = Y − θ(X − X̄) with θ = Cov(Y,X)/Var(X). It works because that covariate is measured before treatment, so it can't be affected by treatment — subtracting it removes noise unrelated to the treatment effect without introducing bias, and variance drops by roughly ρ² where ρ is the covariate's correlation with the outcome.

designHow would you choose a randomization unit for a new experiment?

Default to the user (via a stable ID), since that's usually the unit you want the effect to generalize to and it's simplest to reason about. Escalate to a coarser unit — geo/market, cluster, or a switchback time-region — specifically when there's reason to believe treatment on one unit will contaminate the outcome of another unit in a different arm (shared supply, social connections) — see the SUTVA discussion.

designWhat's the difference between stratified randomization and CUPED — don't they solve the same problem?

Related but distinct. Stratification acts before randomization — it forces balance on a known categorical covariate (e.g. country) at assignment time, preventing an unlucky imbalanced draw. CUPED acts after data collection, as a statistical adjustment using a continuous (or any) pre-period covariate to remove predictable variance regardless of how balanced the raw draw happened to be. In practice teams often use both — stratify on a couple of coarse categorical variables, then apply CUPED on top using a continuous pre-period metric.

A/B testing analysis

analysisWhat's the "peeking problem," and how do modern platforms solve it?

Checking a fixed-horizon test's p-value repeatedly and stopping the moment it crosses 0.05 inflates the true false-positive rate well beyond the nominal 5%, because you're implicitly running many correlated tests and taking the most extreme one. Modern platforms fix this with sequential testing methods — always-valid p-values (e.g. mixture-SPRT based) or group sequential designs with an alpha-spending function — that are constructed to hold their nominal error rate under continuous or repeated monitoring, at the cost of needing a larger maximum sample size and wider CIs for decisions made early.

analysisWhat's a sample ratio mismatch and why do you check for it before trusting any result?

SRM is when the observed split between arms deviates from the intended randomization ratio by more than chance would explain (checked with a chi-square goodness-of-fit test). It signals a broken assignment or logging pipeline — e.g. a bot filter or redirect that behaves differently by arm — which means the two arms may no longer be comparable populations, invalidating the causal interpretation of every other metric in the experiment. It's the first check to run, before looking at the OEC.

analysisExplain Simpson's paradox with an example, and how it could show up in an A/B test.

An effect can reverse when data is aggregated versus split by subgroup, typically because subgroup mix differs between the groups being compared. In an A/B test, if variant B happens to get proportionally more traffic from a lower-converting segment (e.g. mobile), B can look worse in aggregate while actually winning within every individual segment. It's the reason to check segment balance (part of an SRM-style check) and to look at segment-level breakdowns, not just the topline number, when a result looks surprising.

analysisWhy can't you just use the usual variance formula for a ratio metric like "revenue per session"?

Because the numerator (revenue) and denominator (sessions) are correlated at the user level, treating them as independent understates the ratio's true variance and produces overconfident, falsely significant results. The delta method — a first-order Taylor approximation — correctly accounts for that covariance when deriving the standard error of a ratio metric; most experimentation platforms apply it automatically for metrics flagged as ratios.

analysisYou're testing 15 secondary metrics alongside your primary metric. How do you avoid false discoveries?

The primary/OEC metric should be pre-registered and tested at the standard α on its own, since it drives the ship decision. For the 15 secondary metrics being scanned for signal, apply a multiple-comparisons correction — Bonferroni if you need strict family-wise error control, or (more commonly, since it's less conservative) the Benjamini-Hochberg procedure to control the false discovery rate — and treat any secondary "win" as a hypothesis to validate in a follow-up test, not a standalone result to act on.

Interference & causal inference

causalWhat is SUTVA, and give an example of a product context where it clearly fails.

The Stable Unit Treatment Value Assumption: one unit's outcome depends only on its own treatment assignment, not on other units' assignments. It fails in a two-sided marketplace — e.g. a rideshare pricing test, where treated riders pulling more drivers to their area can starve nearby control-arm riders of supply, biasing the estimated effect through resource contention rather than the treatment itself.

causalWhat's a switchback experiment, and when would you reach for one over a standard A/B test?

A design that randomizes time windows within a region (e.g. alternating a delivery market between treatment and control every few hours) instead of randomizing individual users, used when the resource that matters — a shared driver/courier fleet — can't be cleanly split into two static populations without contaminating both arms. The cost is that power depends on the number of time-region cells, not raw order volume, so it typically needs more total traffic than an equivalent user-level test to reach the same power.

causalA feature was rolled out to everyone at once — no holdout was possible. How would you estimate its effect?

Start by asking whether any of the causal-inference conditions apply: is there a natural control group that didn't get it (a different market, a delayed rollout cohort) with pre/post data and plausible parallel trends → difference-in-differences; is it a single unit with a long pre-period and good donor candidates → synthetic control; was eligibility assigned by a threshold → regression discontinuity. If none apply cleanly, say so explicitly, propose the closest available design, and be upfront about which assumption you're least able to verify rather than presenting a point estimate as more certain than it is.

causalWhat's the key identifying assumption behind difference-in-differences, and how would you check it?

Parallel trends — absent treatment, treated and control groups would have moved in parallel over time. It's fundamentally a counterfactual and can't be directly tested, but you build confidence by plotting both groups' outcomes over several pre-treatment periods and checking they track each other closely; a visible pre-trend divergence is a strong warning sign the assumption doesn't hold.

causalWhat does propensity score matching actually protect you from, and what does it not protect you from?

It removes bias from imbalance on observed covariates by matching treated and untreated units with similar P(treatment | X). It offers zero protection against confounding from variables you didn't measure — the unconfoundedness assumption it relies on is fundamentally unverifiable from the data you have, which is the standard critique to raise proactively rather than wait to be asked.

causalWhat does an instrumental variable actually need to satisfy, and what does IV estimate if those hold?

Two conditions: relevance (it meaningfully moves treatment uptake — a weak instrument gives unreliable, high-variance estimates) and the exclusion restriction (it affects the outcome only through treatment, never directly — an assumption you argue substantively, not statistically). If both hold, two-stage least squares recovers the Local Average Treatment Effect — the effect specifically among "compliers," the subpopulation whose treatment status the instrument actually shifts — which need not equal the average effect across everyone.

causalWhen would you reach for regression discontinuity over difference-in-differences?

RDD needs treatment assigned by a sharp, known cutoff on a continuous running variable (a credit score threshold, a usage-count unlock) — the comparison is units just above vs. just below that cutoff, assumed near-identical except for treatment. DiD needs panel data with a treated and control group whose pre-trends run parallel, and doesn't require any threshold at all. Pick RDD when a rule-based cutoff exists and you're comfortable that the estimate will only generalize locally, near that cutoff.

Bayesian framing

bayesianHow would you explain the difference between frequentist and Bayesian A/B testing to a non-technical stakeholder?

Frequentist: "if there were truly no difference, we'd see data this extreme only 5% of the time — so we're treating this as a real difference." Bayesian: "given everything we've seen, there's an 97% probability B is actually better than A." The Bayesian statement answers the question stakeholders usually meant to ask in the first place, which is part of why it's popular for dashboards — but it requires a prior, which needs to be disclosed and justified, not hidden as if it weren't a modeling choice.

bayesianWhy does a Bayesian framework handle continuous monitoring more naturally than a fixed-horizon frequentist test?

A frequentist p-value's validity is tied to a pre-committed sample size or an explicit sequential-testing correction; checking it repeatedly without that correction inflates the false-positive rate. A Bayesian posterior updates coherently after every new data point by construction, so quantities like P(B>A) or expected loss remain valid to inspect at any time — you can define a stopping rule directly on expected loss without a separate correction, though it's still good practice to pre-register that stopping rule rather than deciding it after the fact.

bayesianWhat's the honest criticism of each approach that you'd volunteer in an interview?

Frequentist: p-values are routinely misinterpreted even by practitioners, and the 0.05 threshold is an arbitrary convention, not a law of nature. Bayesian: the prior is a real, consequential modeling choice — an overly informative or poorly chosen prior can pull results toward a preferred conclusion, and it needs to be disclosed and defensible, not treated as a free parameter nobody has to justify.

Applied / scenario

analysisAn experiment shows a statistically significant 0.1% lift in revenue with p = 0.002 at n = 5 million users. Do you ship it?

Not automatically. At n = 5M, even a trivial, practically meaningless effect will often be statistically significant — the question to ask next is the effect size in absolute terms and whether it clears the bar of being worth the engineering/maintenance cost and any guardrail risk, not whether p is small. I'd look at the confidence interval's width and lower bound, check guardrail metrics didn't regress, and weigh implementation/opportunity cost against the actual dollar impact before recommending ship.

designHow would this toolkit change if the "metric" is an LLM output quality score instead of a click-through rate?

The core machinery is unchanged — you still need a pre-registered OEC and guardrails (e.g. quality score as OEC, latency/cost/refusal-rate as guardrails), a power analysis (often against a noisier, more expensive-to-collect metric like human or LLM-judge ratings, which pushes harder toward variance reduction techniques like CUPED using an offline eval score as the pre-period covariate), and the same peeking/multiple-comparison discipline. What changes is the metric's noise profile and collection cost, which usually makes offline eval sets and cheaper automated scorers (with periodic human-eval calibration) the practical way to get enough samples before ever running the online test.

designYour novelty-effect check shows the treatment effect decaying steadily over 3 weeks. How do you decide when to make the call?

Run long enough to see the effect curve visibly flatten (stabilize) rather than stopping at an arbitrary calendar date, ideally isolating new vs. returning users since novelty effects are concentrated in users who've actually noticed the change. If the decision is time-pressured, the more conservative move is to make the call based on the most recent, most-stabilized window of data rather than the cumulative average, which is still weighted down by the inflated early days.

Section 10

Glossary

Every term used in this guide, in one place.

Alpha (α)
The pre-chosen significance level / tolerated Type I error rate, conventionally 0.05.
Alpha-spending function
A rule (e.g. O'Brien-Fleming, Pocock) that allocates a shrinking significance budget across a small number of planned interim looks in a group sequential design, keeping cumulative Type I error at α.
Always-valid p-value
A p-value constructed (typically via a mixture sequential probability ratio test) to remain statistically valid no matter when or how often you check it, unlike a fixed-horizon p-value.
Bayesian inference
Treats an unknown parameter as a random variable with a prior distribution, updated by data via Bayes' rule into a posterior distribution.
Beta distribution
A distribution over probabilities in [0,1]; the conjugate prior for a Binomial/Bernoulli likelihood, standard in Bayesian A/B testing on conversion rates.
CLT (Central Limit Theorem)
The sampling distribution of a mean of enough i.i.d. finite-variance random variables approaches Normal, regardless of the underlying distribution's shape.
Confidence interval
A range constructed so that, over repeated sampling, a stated proportion (e.g. 95%) of such intervals would contain the true parameter.
CUPED
Controlled-experiment Using Pre-Experiment Data — a variance-reduction technique that adjusts an outcome using a pre-treatment covariate, cutting required runtime without bias.
Delta method
A first-order Taylor-series approximation used to derive the correct variance of a ratio (or other function) of correlated random variables, as needed for ratio metrics.
Difference-in-differences (DiD)
Compares the change in outcomes over time between a treated and control group; relies on a parallel-trends assumption.
Estimand / estimator
The true quantity you want to know, versus the data-driven procedure used to estimate it.
Exclusion restriction
The instrumental-variables assumption that an instrument affects the outcome only through its effect on treatment, never directly.
False discovery rate (FDR)
The expected proportion of false positives among all rejected hypotheses; controlled via the Benjamini-Hochberg procedure, commonly used when scanning many secondary metrics.
Guardrail metric
A metric that must not regress in an experiment, regardless of the primary metric's result — can veto a ship decision on its own.
Instrumental variables (IV)
A method using a variable that affects treatment but not the outcome directly, to estimate a causal effect under confounding; estimates the Local Average Treatment Effect via two-stage least squares.
LATE (Local Average Treatment Effect)
The treatment effect specifically among "compliers" — the subpopulation whose treatment status an instrument actually shifts — as estimated by IV.
MDE (Minimum Detectable Effect)
The smallest true effect size an experiment is designed to reliably detect, given its sample size, α, and power.
mSPRT
Mixture sequential probability ratio test — the statistical basis for many always-valid p-value implementations used for continuous experiment monitoring.
Multiple comparisons problem
The inflation of false-positive probability that occurs when testing many hypotheses (metrics, segments, variants) at the same α without correction.
Novelty effect
A treatment effect inflated early on purely because the change is new, which decays as users grow accustomed to it.
OEC (Overall Evaluation Criterion)
The single primary metric (or small composite) an experiment's ship decision is based on, chosen before the experiment runs.
Peeking problem
The false-positive inflation caused by repeatedly checking a fixed-horizon test's p-value and stopping as soon as it crosses the significance threshold.
Posterior distribution
In Bayesian inference, the updated distribution over a parameter after combining a prior with observed data.
Power (statistical)
1 − β; the probability of correctly detecting a true effect of a given size.
Primacy effect
A treatment effect suppressed early on because users need time to adjust to a change, appearing only once they've re-learned the new behavior.
Propensity score matching (PSM)
Matches treated and untreated units on their estimated probability of receiving treatment given observed covariates, to construct a comparable control group.
Ratio metric
A metric expressed as a ratio of two correlated quantities (e.g. revenue per session), requiring the delta method for correct variance estimation.
Regression discontinuity (RDD)
Compares units just above and below a sharp treatment-assignment threshold on a continuous running variable, estimating a local causal effect.
Sample ratio mismatch (SRM)
A statistically significant deviation between observed and intended arm-size ratios, signaling a broken assignment or logging pipeline.
Sequential testing
Statistical methods (always-valid p-values, group sequential designs) that remain valid under repeated or continuous monitoring, unlike fixed-horizon tests.
Simpson's paradox
A phenomenon where an effect reverses direction between aggregated data and every individual subgroup, typically caused by an uneven subgroup mix between the groups compared.
Stratified randomization
Forcing balance on a known categorical covariate at assignment time by randomizing within strata, reducing variance from imbalanced draws.
SUTVA
Stable Unit Treatment Value Assumption — one unit's outcome depends only on its own treatment, not on other units' assignments; frequently violated in marketplaces and social networks.
Switchback experiment
A design that randomizes time windows within a region rather than units, used when a shared resource (e.g. a delivery fleet) makes user-level randomization biased by interference.
Synthetic control
Constructs a weighted composite of untreated units whose pre-treatment trajectory matches a single treated unit, used to estimate that unit's treatment effect.
Type I / Type II error
A false positive (rejecting a true null) versus a false negative (failing to reject a false null).
Unconfoundedness
The (unverifiable) assumption underlying propensity score matching that no unobserved variable drives both treatment selection and the outcome.
Section 11

Sources