Experimentation Fundamentals: Statistical Testing and Causal Methods
Statistics & ExperimentsModel answerLast updated
Demonstrate your understanding of controlled experiments, error types, metrics design, confounding, and causal inference techniques for product analytics.
You're interviewing for a product analytics role at a consumer technology company. The team runs controlled experiments to evaluate new features and relies on observational methods when randomization isn't feasible.
Answer the following:
-
P-value interpretation: What does a p-value actually measure? What common misconceptions should analysts avoid?
-
Error types: Define Type I and Type II errors in the context of product experiments. How do you balance the trade-off between them?
-
Experiment workflow: Walk through the complete process of designing, running, and analyzing a randomized experiment, from initial hypothesis to final decision.
-
Simpson's paradox: Explain this phenomenon, provide an example of how it can appear in experiments, and describe how you would detect and handle it.
-
Metrics selection: For a consumer app feature launch, propose a primary metric, supporting metrics, and guardrail metrics. Explain your rationale.
-
Observational causal methods: Name and describe two techniques for estimating causal effects when you cannot randomize. When would you apply each one?
Your answer should demonstrate both statistical rigor and practical judgment in real product scenarios.
Hints
Hint 1
Consider the full experiment lifecycle: hypothesis formation, power calculations, randomization strategy, validity checks, and multiple-comparison corrections
Hint 2
For Simpson's paradox, think about how allocation imbalances across segments can flip aggregate results, and what diagnostics reveal these issues
Hint 3
When randomization isn't possible, think about methods that leverage time-series structure or covariate balancing to approximate counterfactuals
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer: Experimentation and Causal Inference Fundamentals
This question tests your grasp of both the statistical mechanics of controlled experiments and the practical judgment needed to ship features confidently. Strong answers demonstrate precision in definitions, awareness of common pitfalls, and concrete examples.
1. P-value interpretation
A p-value is the probability of observing a test statistic at least as extreme as the one calculated from your data, under the assumption that the null hypothesis is true.
For example, if you're testing whether a new search ranking algorithm increases click-through rate, H₀ states there's no difference between variants. A p-value of 0.04 means: if the variants truly performed identically, you'd see a difference this large or larger in about 4% of experiments due to random sampling variation alone.
Common misconceptions to avoid:
- It is not the probability that the null hypothesis is true given your data—that's a Bayesian posterior, not a frequentist p-value
- It does not measure effect size—a tiny, practically irrelevant difference can have p < 0.001 with enough data
- p = 0.07 doesn't mean "no effect"—it means insufficient evidence to reject H₀ at the conventional α = 0.05 threshold
- Always pair p-values with effect size estimates and confidence intervals: "+2.8% lift in CTR, 95% CI [+0.4%, +5.2%], p = 0.02" tells the complete story
2. Type I and Type II errors
| H₀ true (no real effect) | H₀ false (real effect exists) | |
|---|---|---|
| Reject H₀ | Type I error (α) | Correct detection (power) |
| Fail to reject | Correct | Type II error (β) |
- Type I error (false positive): You conclude the variant is better when it isn't, and ship a change that wastes resources or harms metrics. Rate controlled by α, typically 0.05
- Type II error (false negative): You miss a real improvement and kill a feature that would have added value. Rate β, typically 0.20, giving 80% power (1 − β)
Balancing the trade-off: For a fixed sample size, reducing α increases β. The right balance depends on decision costs:
- For high-risk changes (monetization, privacy, infrastructure), use stricter α (0.01 or lower) to avoid false launches
- For low-cost UI iterations, slightly relaxed α may be acceptable
- Increase sample size to reduce both error types simultaneously
- Use techniques like CUPED (Controlled-experiment Using Pre-Experiment Data) to shrink variance and boost power without collecting more data
3. End-to-end experiment workflow
Planning phase
-
Formulate hypothesis: "Reducing form fields from 8 to 5 will increase signup completion by shortening the user path"
-
Select metrics: One primary (signup conversion), plus secondary (time-to-complete, field error rate) and guardrails (spam signups, support contacts)
-
Choose randomization unit: Typically user ID. Use session-level only if there's no learning or carryover effect. Use cluster randomization (e.g., by city or merchant) when network effects exist
-
Power analysis and sample sizing: For a two-proportion test detecting minimum detectable effect (MDE) δ with baseline rate p:
n ≈ 2(z₁₋α/₂ + z₁₋β)² · p(1−p) / δ²
Example: baseline p = 0.25, want to detect 10% relative lift (δ = 0.025), α = 0.05, power = 0.8:
- n ≈ 2(1.96 + 0.84)² · 0.1875 / 0.000625 ≈ 3,100 users per arm
Run for at least one full week to capture day-of-week effects
-
Pre-register analysis plan: Declare primary metric, significance threshold, subgroups of interest, and stopping criteria upfront to prevent p-hacking
Execution phase
- Pre-flight checks: Run A/A test to verify random assignment is working; validate logging and metric pipelines
- Gradual ramp: Start at 1% treatment, then 5%, 10%, 50% to catch bugs early and limit blast radius
- Monitor without peeking: Either wait until planned sample is reached, or use sequential testing methods (alpha spending functions) if you need early stopping capability
Analysis phase
-
Sanity checks:
- Sample Ratio Mismatch (SRM): Chi-square test that observed split matches intended allocation ratio
- Check covariate balance: distribution of device type, country, user tenure should be similar across arms
- Plot metrics over time to spot novelty effects (initial excitement that fades) or primacy effects (initial confusion that resolves)
-
Compute results:
- Estimate lift and confidence interval on primary metric
- For ratio metrics (revenue per user), use delta method or bootstrap for correct standard errors
- Apply multiple-testing corrections (Bonferroni or Benjamini-Hochberg) when examining many secondary metrics or segments
-
Segment analysis: Explore heterogeneous treatment effects by platform, user tenure, geography—but treat these as hypothesis-generating unless pre-specified
Decision phase
- Ship/iterate/kill decision: Weigh statistical significance against practical significance, implementation cost, and long-term strategic value. Consider holding out a small control group post-launch to measure longer-term effects
4. Simpson's paradox
Simpson's paradox occurs when a relationship observed within every subgroup reverses or vanishes when subgroups are aggregated. A confounding variable drives both group membership and the outcome.
Example:
| Platform | Control conversion | Treatment conversion |
|---|---|---|
| Desktop | 180/900 = 20.0% | 55/250 = 22.0% |
| Mobile | 15/100 = 15.0% | 120/750 = 16.0% |
| Total | 195/1000 = 19.5% | 175/1000 = 17.5% |
Treatment wins on both platforms but loses overall because it received a disproportionate share of lower-converting mobile traffic.
Detection in experiments:
- Run SRM checks overall and within major segments (platform, country, new vs. returning)
- Compare segment composition across arms: are device type, time-of-day, user demographics balanced?
- Stratify analysis and compare segment-level effects to pooled estimate
- If allocation shifted mid-experiment (e.g., during ramp-up), analyze by time cohort
How to handle it:
- If randomization is correct: The paradox suggests segment mix differs, but the aggregate causal effect is still valid if you care about the overall user population
- If there's an SRM: Fix the bug and re-randomize
- If a confounder is present (more common in observational studies): Report stratified estimates or use methods like Cochran-Mantel-Haenszel to compute a properly weighted average
- Draw a causal diagram (DAG): if the segment variable is a mediator (treatment causes users to switch platform), aggregate effect is correct; if it's a confounder, stratify
5. Metrics selection (example: video streaming app adding "continue watching" row)
Primary metric (one, decisive):
- Weekly active time per user: Total minutes streamed per weekly active user. Directly measures engagement, sensitive to UX changes, and moves quickly
Secondary metrics (explain mechanism and broader impact):
- Session frequency: Number of app opens per user per week
- Content discovery rate: Fraction of users who start a new show (not just resume)
- Video completion rate: Percentage of started videos watched to 90%+
- Retention: 7-day and 28-day return rate
Guardrail metrics (must not degrade):
- Buffering rate and playback errors
- App crash rate
- Customer support ticket volume
- Subscription cancellation rate (churn)
- Server costs per user (if change affects caching or bandwidth)
Rationale: The primary metric should align with long-term product goals (engagement → retention → revenue). Secondary metrics illuminate why it moved and catch unintended consequences. Guardrails protect technical performance, user trust, and unit economics. Avoid too many—multiple primaries invite cherry-picking, and excessive secondaries increase false discovery rate.
6. Causal inference without randomization
Difference-in-Differences (DiD)
When to use: A treatment is applied to one group or region at a specific time, but not to a comparable control group. Examples include policy changes (GDPR affecting EU users), regional feature rollouts, or merchant-tier interventions.
How it works: Estimate the effect as: (Treatment_post − Treatment_pre) − (Control_post − Control_pre)
This removes both time trends (common to both groups) and group fixed differences (constant over time).
Key assumption: Parallel trends—without treatment, both groups would have followed the same trajectory. Validate by:
- Plotting pre-treatment trends for several periods; they should move together
- Running placebo tests on pre-treatment periods
- Event-study design with leads and lags to check for anticipatory effects
- If only one treated unit exists (e.g., one city), use synthetic control to construct a weighted combination of control units that mimics pre-treatment behavior
Example: A state introduces a new digital sales tax. Compare sales growth in that state vs. a synthetic control built from similar states without the tax.
Propensity Score Methods (Matching or Inverse Probability Weighting)
When to use: Users self-select into treatment (e.g., opting into a premium tier, choosing to enable notifications), and you want to estimate the causal effect while controlling for confounders.
How it works:
- Model the probability of treatment given observed pre-treatment covariates: P(T=1 | X) using logistic regression or a boosted model
- Matching: Pair each treated unit with control units having similar propensity scores, then compare outcomes
- Weighting (IPW): Weight treated units by 1/p(X) and controls by 1/(1−p(X)) to create a pseudo-population where treatment is independent of X
Key assumption: Unconfoundedness (no unmeasured confounders)—all variables affecting both treatment selection and outcome are observed and included in X.
Diagnostics:
- Check covariate balance after matching/weighting using standardized mean differences
- Test sensitivity to unmeasured confounding (e.g., Rosenbaum bounds)
- Use domain knowledge to argue confounders are captured
Example: Estimating the effect of enabling two-factor authentication on account security. Users who enable 2FA may already be more security-conscious (confounder). Match on prior password strength, account age, login frequency, and device type, then compare breach rates.
Common mistakes to avoid
- Confusing statistical significance with practical importance
- Running many unplanned subgroup analyses without correction, leading to spurious findings
- Ignoring variance reduction techniques, leading to underpowered tests
- Misapplying observational methods when key confounders are unmeasured
- Failing to check for sample ratio mismatch or other randomization failures
Strong candidates demonstrate not just statistical knowledge but operational discipline: pre-registration, sanity checks, transparent reporting, and clear communication of uncertainty.