Advanced Experimentation Designs Questions
Experimentation techniques beyond the simple two-arm A/B test: causal inference and quasi-experiments, sequential and always-valid testing, multi-armed bandits, factorial and multivariate designs, and handling interference or network effects. Covers when randomized experiments are infeasible and difference-in-differences, instrumental variables, or switchback designs apply. The concept scope is methodology selection for hard experimental situations.
A developer-facing feature affects only 120 eligible users worldwide, so a standard parallel A/B test would be badly underpowered. Outline alternative evaluation strategies, such as within-subject/paired designs, switchback or cluster-randomized-trial framing, a holdout ramp, qualitative feedback, or case studies, and explain when a cluster-randomized or switchback design should be chosen over individual-level randomization at this scale. Propose a practical plan, including metric selection, instrumentation, and a rollout recommendation, that yields actionable evidence despite the tiny population.
Sample Answer
Direct answer: With only 120 eligible users worldwide, abandon a standard between-subject parallel A/B test (verified underpowered below) and instead reach for a WITHIN-SUBJECT (paired) design, a switchback/time-block design if the feature has a natural on/off toggle per user or per small cluster, a holdout ramp with close qualitative tracking, or a case-study/qualitative approach if even a paired design cannot reach adequate power. Choose a cluster-randomized or switchback design over individual-level randomization specifically when the 120 users cluster naturally into groups (teams, organizations, workspaces) where within-cluster interference is likely, e.g. developers on the same team influence each other's usage patterns, in which case individual-level randomization would violate SUTVA within the cluster the same way social-network interference does at consumer scale (this topic's sibling a-b-test-design-and-statistical-rigor owns that consumer-scale case; the tiny-population, small-cluster version is this topic's ground).
Why a standard parallel test is underpowered (executed): with N=120 total (60/arm), baseline conversion 30%, and even a generous 33% relative lift target (0.30 to 0.40, larger than most real product effects), achieved power is only about 21%. The required N for 80% power at that same generous MDE would be 712 total (356/arm), nearly 6x the entire available population. Any smaller, more realistic effect size would need even more, confirming a between-subject design simply cannot work at this scale.
Why a within-subject (paired) design helps: pairing removes BETWEEN-user variance from the comparison, since each user serves as their own control (measured before and after, or under both conditions). With within-user correlation ρ=0.5 (a moderate, realistic value for a within-user metric measured twice), the paired-design effective standard-deviation multiplier is 2(1−ρ)=1.0, versus 2≈1.41 for an independent between-subject comparison, roughly HALVING the required sample size for the same power and MDE (since required N scales with the square of that multiplier, 1.02/1.412≈0.5). For 120 users, this can be the difference between an infeasible and a feasible test.
Practical plan:
- Metric selection: choose a metric with LOW within-user noise and short time-to-signal (e.g. task-completion rate or time-to-first-success on the developer-facing feature) rather than a slow, high-variance business metric like long-term retention, which would need far more than 120 users regardless of design.
- Instrumentation: capture per-user, per-period usage tightly enough to compute a clean pre/post or on/off comparison per user, and log enough contextual detail (which org/team each user belongs to) to check for and adjust for within-cluster correlation if the 120 users cluster into teams.
- Design choice given clustering: if the 120 users sit in, say, 15 teams of 8, prefer CLUSTER-randomization or a team-level switchback over individual randomization, since individually randomizing within a team risks contamination (control users on a team where teammates are treated may indirectly experience the feature via shared docs/workflows); if the users are genuinely independent (different companies, no interaction), individual-level within-subject randomization is fine and simpler.
- Rollout recommendation: run a holdout-ramp: enable the feature for a majority of the 120 (or all, using a within-subject pre/post design with a smaller true holdout group retained purely to distinguish the treatment effect from a general time trend), supplement the quantitative signal with structured qualitative feedback (brief surveys or interviews with a sample of the 120), since at this population size qualitative and case-study evidence carries proportionally MORE weight in the final ship/no-ship decision than it would in a consumer-scale test, and treat the quantitative estimate as directional rather than a precise point estimate given the residual power limitations even after pairing.
Describe how to design and analyze a switchback (crossover) experiment where a marketplace or product alternates between control and treatment on a time-block schedule, for example weekly. Explain how you would randomize the block-assignment schedule, choose a washout period and detect carryover effects, control for time trends and seasonality in the analysis, and determine how many blocks you need to reliably detect a treatment effect. Give at least two concrete cases where a crossover/switchback design would be inappropriate.
Sample Answer
Direct answer: A switchback experiment assigns TIME BLOCKS (for example, whole weeks or days for an entire market or region), not individual users, to control or treatment, alternating on a schedule; it is the standard fix when individual-level randomization is invalid because treated and control units share a common resource pool (drivers, inventory, ad auction) that lets treatment "leak" into control, the SUTVA-violation problem this topic's sibling a-b-test-design-and-statistical-rigor closes for USER-level interference but does not cover for TIME-block designs.
Randomizing the schedule: do not simply alternate control-treatment-control-treatment on a fixed clock; randomize the block ORDER (e.g. randomly assign each week to control or treatment subject to a balance constraint, roughly half of each) so that any systematic weekly pattern (day-of-week mix, holiday timing) is not perfectly confounded with the treatment schedule, and randomize the STARTING phase across different markets/regions if running the switchback in parallel across several geographies, so a market-specific event does not land on the same treatment/control alignment everywhere.
Washout period and carryover: a washout period is a buffer at the START of each new block (for example, the first hour of a new week) during which data is DISCARDED from analysis, to let effects from the PRIOR block's treatment (driver repositioning, cached recommendations, habituation) dissipate before the new block's measurement window begins. Choose the washout length from domain knowledge of how fast the system's state resets (e.g. driver-supply rebalancing might take 30-60 minutes in a ride-hailing market, materially shorter than the week-long block itself). To DETECT carryover statistically: fit a model with a lagged treatment indicator (whether the PREVIOUS block was treatment) alongside the current block's treatment indicator; a significant lagged-treatment coefficient is evidence of carryover that the washout period is not fully absorbing, and the washout should be lengthened.
Controlling time trends and seasonality (executed simulation): naive difference-in-means between treatment and control blocks is BIASED whenever the treatment schedule is correlated with time, which is common in real switchback schedules (e.g. an operationally simpler "2 weeks control, 2 weeks treatment" alternating pattern, rather than fully independent per-week randomization). I simulated 40 weekly blocks on a 2-week-alternating schedule, a true treatment effect of 0.05, a linear time trend of 0.004/week, and noise SD 0.05, and repeated 3,000 times:
- naive diff-in-means: mean bias = +0.0077 (about 15% relative bias on the true 0.05 effect), RMSE = 0.0175
- regression adjusting for the linear time trend (fitting y=β0+β1⋅week+β2⋅treat+ε and reading β2): mean bias = -0.0003 (essentially unbiased), RMSE = 0.0158
This confirms the analysis MUST include a time-trend term (or week fixed effects, or a seasonal/day-of-week control), not a raw difference in block means, whenever the treatment schedule is not perfectly independent of time, which it rarely is in operationally realistic switchback schedules.
Sample size / number of blocks: switchback power depends on the NUMBER OF INDEPENDENT TIME BLOCKS, not the number of users within a block (users within a block are correlated through the shared time-block treatment, so they do not each contribute independent information the way users in a standard parallel A/B test do); as a rule of thumb, plan for at least 15 to 20 independent blocks per arm to get a usable estimate of the block-to-block variance needed for valid inference (analogous to needing enough clusters in a cluster-randomized trial), and use a block-level (not user-level) t-test or randomization-inference test on the block averages, whose within-block sample size mainly reduces MEASUREMENT NOISE per block rather than increasing the effective number of independent observations.
Two cases where a crossover/switchback design is inappropriate: (1) when the treatment has a PERSISTENT, long-lasting effect that does not wash out within a reasonable block length, for example a pricing change that shifts long-term customer trust or a feature that permanently changes user habits, the "carryover" here is not a short-term artifact to buffer away but the actual long-run effect you are trying to measure, and a switchback would systematically underestimate it; (2) when the unit being switched (a whole market or region) is small enough, or the treatment disruptive enough, that ALTERNATING it repeatedly causes operational instability or a bad user experience (users noticing prices or features flip back and forth week to week), which is both a product-quality risk and a threat to validity if users start changing their OWN behavior in anticipation of the alternation.
Formulate and solve an optimization problem to allocate a fixed total sample across the cells of a factorial design so as to minimize the variance of the estimated interaction effect, given that cells differ in per-user cost. State your decision variables, objective function, and constraint, derive the resulting allocation rule, and work a numeric example.
Sample Answer
Direct answer: Formulate this as: minimize the variance of the interaction-effect estimator, Var(θ^AB)=∑i=14σi2/ni (the four-cell +1/-1/-1/+1 contrast estimator's variance, assuming independent cells with per-cell variance σi2), subject to a total-cost budget constraint ∑icini=B, where ni (the sample size in cell i) are the decision variables, ci the known per-user cost or complexity weight of cell i, and B the fixed budget.
Deriving the allocation rule: using a Lagrangian, L=∑iσi2/ni+λ(∑icini−B), setting ∂L/∂ni=−σi2/ni2+λci=0 gives ni∝σi/ci: allocate MORE sample to cells that are noisier (higher σi) and LESS to cells that are more expensive (higher ci), the classic Neyman-allocation rule generalized to cost-weighted variance minimization.
Worked numeric example (executed): suppose all four cells have the same outcome variance (σi=0.14 for all i, e.g. a conversion-rate-like metric), but cell 4 (both treatments simultaneously on) is 5x costlier per user, for instance because it requires manual QA/concierge support, so c=[1,1,1,5], budget B = 400,000 cost-units.
- EQUAL allocation (n=50,000 in every cell, spending the budget evenly): Var(θ^AB)=1.568×10−6.
- NEYMAN-OPTIMAL allocation (ni∝σi/ci): n* = [76,393, 76,393, 76,393, 34,164] (budget check: ∑cini∗=400,000, exact), giving Var(θ^AB)=1.343×10−6.
That is a 14.3% variance reduction versus equal allocation for the SAME total cost budget, purely from shifting sample away from the expensive cell 4 toward the three equally-noisy, cheaper cells.
Practical simplifications: (1) if per-cell variances are genuinely similar (the common case for conversion-rate-like metrics with similar baseline rates), the allocation collapses to pure cost-weighting, ni∝1/ci, which is easy to compute without needing pilot-data variance estimates; (2) if BOTH cost and variance vary substantially and in the SAME direction (e.g. the noisier cell is also the pricier one), the two effects partially cancel and the gain from optimizing over equal allocation shrinks, in a version of this example with cell 4 at both 3x cost AND roughly 2x the SD, the improvement dropped to about 1%, so it is worth checking numerically rather than assuming Neyman allocation always helps a lot; (3) in practice, run this as a one-time pre-launch calculation using pilot-period variance and known engineering-cost estimates, not as a live-adjusting allocation, since re-allocating traffic mid-experiment reintroduces the kind of assignment-pipeline risk the sibling topic's A/A-test validation content is designed to catch.
Design a post-hoc analysis to detect cross-experiment contamination between two simultaneous experiments A and B. Given user-level logs with experiment assignments and outcomes, outline statistical tests or models, such as interaction-term regressions and permutation tests, to detect whether assignment to A modified the effect of B. Then discuss how you would attribute a change in a shared downstream conversion metric to individual upstream experiments when multiple teams' experiments feed the same funnel.
Sample Answer
Direct answer: Fit a regression of the shared outcome on both experiments' assignment indicators PLUS their interaction term (y=β0+β1A+β2B+β3(A×B)+ε); a statistically significant β3 means assignment to A modified B's effect (or vice versa, the interaction is symmetric), the signature of cross-experiment contamination. Confirm the regression-based finding with a permutation test on β3 (assumption-free, robust to the regression's parametric assumptions) before treating it as real. When multiple upstream experiments feed the same downstream metric, use a similar interaction-regression or a structural/layered-holdout approach to attribute the downstream change to individual upstream sources.
Interaction-term regression, verified working (executed): I simulated 20,000 users independently assigned to experiments A and B, with a planted TRUE contamination effect of β3=0.06 (i.e. A's effect on the shared metric genuinely depends on B's assignment) plus small independent main effects and noise. The fitted model recovered β^3=0.0607 (standard error 0.0042, t=14.31, p ≈ 0), correctly detecting the planted contamination at high confidence.
Permutation test (executed, model-assumption-free confirmation): I re-ran the same interaction estimate 500 times, each time RANDOMLY SHUFFLING experiment B's assignment (which destroys any true A x B relationship while preserving each variable's marginal distribution) and re-fitting the interaction coefficient. The permutation p-value, the fraction of shuffled-B interaction estimates at least as extreme as the observed β^3, was pperm=0.004, well below 0.05, confirming the interaction-regression result is not an artifact of the regression's normality/homoscedasticity assumptions.
Why run both: the analytic regression t-test is fast and gives a standard error and confidence interval for the SIZE of the contamination, useful for deciding whether it is business-meaningful, not just statistically detectable; the permutation test is slower but assumption-free, a useful independent confirmation particularly if the outcome metric is skewed or the sample is modest enough that the regression's asymptotic normality assumption is questionable.
Attributing a shared downstream metric to individual upstream experiments (multiple teams feeding the same funnel): (1) if the upstream experiments are ORTHOGONALLY assigned (verified independent per S9), extend the same interaction-regression approach to include ALL upstream assignment indicators plus their pairwise interactions with each other on the shared downstream outcome, the main-effect coefficients then give each experiment's OWN attributable contribution net of the others, and any significant interaction terms flag genuine cross-experiment effects rather than clean independent attribution; (2) if the upstream experiments are NOT independent, for example nested or sequential in the funnel (experiment 1 changes who even reaches the point where experiment 2 applies), a pure regression attribution is unreliable, and a LAYERED-HOLDOUT design, where a small slice of traffic is held out of ALL upstream experiments simultaneously and used as the pure counterfactual baseline for the downstream metric, gives a cleaner (if smaller-sample) attribution than trying to decompose correlated upstream effects via regression alone; (3) whichever approach is used, be explicit with stakeholders about the SCALABILITY limits, attribution via pairwise-interaction regression grows combinatorially in the number of upstream experiments and quickly becomes underpowered past a handful, and the layered-holdout approach has a real operational cost (traffic held back from every upstream experiment simultaneously), so in practice this kind of full attribution analysis is reserved for genuinely contested or high-stakes downstream-metric disputes between teams, not run routinely on every pair of concurrent experiments.
When should you choose a factorial or multivariate (MVT) design instead of running a sequence of separate A/B tests on individual features? Discuss the trade-offs in speed of learning, statistical power for main effects versus interactions, interpretability, and operational complexity, then give a concrete business scenario where a factorial design is clearly the better choice.
Sample Answer
Direct answer: Choose a factorial (or multivariate/MVT) design over a sequence of separate A/B tests when you have two or more candidate changes you plausibly want to ship TOGETHER, you suspect (or must rule out) an interaction between them, and you have enough concurrent traffic to split into cells without starving any one cell's power. Choose sequential single-factor A/B tests when changes are independent, traffic is scarce, or you need to ship and learn on the first change before the second is even designed.
Trade-offs
- Speed of learning: factorial wins when the alternative is truly SEQUENTIAL (test A, wait, then test B). For the same total sample budget, a k-factor design estimates all k main effects roughly as precisely as k separate two-arm tests run one after another with the SAME total budget split across them, but the factorial gets all k answers CONCURRENTLY instead of one-after-another, and gets the interaction essentially for free.
- Statistical power for main effects versus interactions: each main effect in a factorial is estimated by comparing half the cells against the other half (pooling over the other factor), so main-effect power is comparable to a standalone two-arm test at the same total N. The INTERACTION contrast is NOT pooled the same way: it needs the same per-cell sample size as a single unpooled cell-vs-cell comparison, so detecting an interaction of the same absolute size as a main effect costs roughly 2x the total sample of detecting that main effect alone (verified numerically in S1).
- Interpretability: a single-factor sequential test has a trivial reading ("does this metric move"). A factorial with a significant interaction requires explaining conditional effects ("A only works when B is on"), which is harder to communicate and can confuse stakeholders unless you plan for it (see S6).
- Operational complexity: factorial designs need every combination of treatments to be simultaneously deployable and measurable, more engineering coordination, more QA surface (interaction bugs, cross-feature conflicts), and a bigger simultaneous "blast radius" if something goes wrong, versus shipping and validating one change at a time.
Worked confirmation (executed simulation, not just cited): simulating 2 factors with true additive effects of size 0.12 (in outcome-SD units) each, total budget N=4000, alpha=0.05, over 4000 replications:
- FACTORIAL (4 cells of 1000 each): power(A) = 0.965, power(B) = 0.961
- SEQUENTIAL (2 separate 2-arm tests, same total budget split in half, 1000/arm each): power(A) = 0.771, power(B) = 0.759
For the identical total sample budget, the factorial design delivered materially higher power on BOTH main effects (0.96+ vs 0.77) because every unit in a factorial cell contributes to estimating EVERY factor's main effect (a unit in the (A=1,B=1) cell informs both the A comparison and the B comparison), while the sequential approach wastes half its budget on a control arm that is redundant across the two separate tests.
Business scenario where factorial is clearly preferable: a subscription product wants to test (1) a new pricing page copy and (2) a redesigned onboarding flow. Product suspects the pricing framing only lands if users have already been walked through the new onboarding (an interaction hypothesis: pricing-copy effect is conditional on onboarding version). Running these sequentially would answer "does new pricing help" and "does new onboarding help" separately but could never detect that new pricing ONLY helps when paired with new onboarding, exactly the finding the business needs to decide whether to ship them together, separately, or not at all. A 2x2 factorial answers all three questions (both main effects plus the interaction) in one concurrent test.
When NOT to use factorial: if you have 4+ factors, a FULL factorial's cell count (2^4 = 16 cells) can quickly outstrip available traffic; that is exactly the constrained-traffic case that motivates fractional factorial designs (S2, S3) rather than abandoning multi-factor testing altogether.
Unlock Full Question Bank
Get access to all 10 Advanced Experimentation Designs interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.