Hypothesis Testing and A/B Test Design: t-Tests, p-Values, and Power
What You'll Learn
- 1State null and alternative hypotheses for business questions
- 2Interpret p-values, effect sizes, and power correctly
- 3Choose t-tests and chi-square tests appropriately
- 4Control false discoveries across many metrics and segments
Hypothesis testing provides a disciplined language for deciding whether an observed difference could plausibly arise from random chance alone. t-tests and chi-square procedures cover means and proportions, while power analysis determines sample size before a test launches. p-values are often misread, so careful design, pre-registration, and multiplicity control separate credible experiments from noise mining.
From Business Question to Statistical Hypothesis
Translate the decision into a null hypothesis of no effect and an alternative that matches the business claim. Specify the primary metric, minimum detectable effect, and decision rule before looking at results. This pre-commitment blocks metric shopping and hindsight rationalization.
Choose the test that matches the data: independent t-tests or Welch variants for continuous outcomes across groups, paired tests for before-after on the same units, and chi-square or z-tests for proportions and contingency tables. Check independence, distribution shape, and variance assumptions, or reach for nonparametric alternatives.
p-Values, Effect Sizes, and Power
A p-value is the probability of observing an effect at least as extreme as the sample, assuming the null is true. It is not the probability the null is true, and it says nothing about practical importance. Always report effect size and confidence interval next to the p-value.
Power is the probability of detecting a true effect of a chosen size, typically targeted at 80 percent or higher. Underpowered tests waste traffic by missing real wins and producing unstable estimates. Compute sample size from baseline variance and minimum detectable effect before the experiment starts.
Multiple Testing and Experiment Hygiene
Testing twenty metrics at the 0.05 level expect about one false positive by chance alone. Control family-wise error with Bonferroni or Holm, or control false discovery rate with Benjamini-Hochberg when exploring many hypotheses. Declare one primary metric and treat the rest as guardrails or secondary.
Watch for peeking without correction, sample ratio mismatch, seasonality, network effects, and novelty spikes. Sequential testing or fixed horizons with proper boundaries keep optional stopping from inflating false positives. Document exclusions, iterations, and stopping rules so the result survives peer review.
Common Tests for Analysts
| Scenario | Typical test | Key assumption |
|---|---|---|
| Two group means, continuous metric | Welch t-test | Independence, roughly stable variance |
| Paired before and after | Paired t-test | Differences approximately normal |
| Proportions between variants | Two-proportion z-test | Adequate counts in each cell |
| Multi-category association | Chi-square test | Expected counts not tiny |
| Non-normal small samples | Mann-Whitney or permutation | Ordinal or distribution-free comparison |
| Many simultaneous metrics | FDR or Holm correction | Defined family of hypotheses |
Real-World Examples
- Checkout button test â Variant B lifts checkout completion by 1.2 percentage points with a 95 percent interval excluding zero, clearing the pre-agreed minimum detectable effect.
- Chi-square on plans â A chi-square test shows plan type and upgrade event are associated across three tiers, prompting deeper segment analysis.
- Underpowered failure â A two-week test with tiny traffic shows no significant difference; analysts recommend a longer horizon rather than declaring equality.
- Multiple metrics trap â Scanning thirty KPIs finds one significant result; FDR correction reveals it does not survive, preventing a false rollout.
â ī¸p-Value Is Not an Effect Size
Common Mistakes
Stopping a test early when it looks good
Fix: Peeking repeatedly inflates false positives; use fixed horizons or valid sequential boundaries.
Ignoring multiple comparisons across segments
Fix: Pre-specify primary metrics, apply corrections, and treat slice findings as hypotheses for follow-up.
Equating non-significance with no effect
Fix: Non-significance may reflect low power; report the interval and minimum effect the test could have detected.
Key Takeaways
- Pre-register hypotheses, metrics, and decision rules.
- Power analysis sets sample size before launch.
- p-values need effect sizes and confidence intervals.
- Multiplicity corrections curb false discoveries.
Frequently Asked Questions
What does a p-value of 0.03 mean?
Under the null, results this extreme or more would occur about 3 percent of the time. It is not the probability that the null hypothesis is true.
How long should an A/B test run?
At least one full business cycle, often one to four weeks, and until the pre-calculated sample size is reached without early optional stopping.
When is chi-square better than a t-test?
Use chi-square for counts and proportions across categories; use t-tests for continuous metrics such as revenue per user or session length.
Interview Questions
Q1: How do you size an A/B test?
Estimate baseline rate or variance, choose the minimum detectable effect that matters to the business, pick alpha and power, then compute required sample size per variant and convert to runtime using daily traffic.
Q2: How do you handle many metrics in one experiment?
Define one primary metric for the decision, a set of guardrail metrics with corrections, and label exploratory slices as secondary so false discovery rates stay controlled.
Extended Learning: Beyond the Basics
Key Concepts Summary
This lesson covers fundamental concepts that serve as building blocks for more advanced topics. Master these basics before moving to intermediate and advanced material.
Prerequisite Knowledge
Before studying this topic in depth, ensure you understand:
- Basic definitions and terminology
- Core formulas and their derivations
- Common applications in real-world scenarios
- Typical pitfalls and misconceptions
Step-by-Step Walkthrough
Let us work through a complete example to solidify understanding:
Step 1: Identify the problem type. Determine which category this problem falls into and which approach is most appropriate.
Step 2: Apply the relevant formula. Substitute known values into the appropriate equation, paying attention to units and constraints.
Step 3: Simplify and solve. Work through the algebra step by step, checking each intermediate result.
Step 4: Verify the answer. Check that the solution satisfies the original conditions and makes logical sense.
Common Mistakes to Avoid
- Misidentifying the problem type â Always start by categorizing the problem
- Incorrect formula application â Verify the formula applies to your specific case
- Unit errors â Always check units are consistent throughout
- Sign errors â Pay careful attention to positive and negative values
- Rounding too early â Keep full precision until the final answer
- Forgetting constraints â Check that solutions satisfy all given conditions
Real-World Applications
Understanding this concept is essential for:
- Advanced problem solving in examinations
- Building intuition for more complex topics
- Developing analytical thinking skills
- Applying mathematical reasoning to practical situations
Practice Exercises
- Basic: Solve 5 problems of increasing difficulty using the core concept.
- Intermediate: Apply the concept to word problems with multiple steps.
- Advanced: Combine this concept with 2-3 other topics in a comprehensive problem.
- Challenge: Create your own problem that requires this concept plus additional knowledge.
Interview and Exam Tips
- Common question patterns: Identify which exam or interview formats test this topic
- Time management: Practice completing problems within time constraints
- Common traps: Know the typical mistakes examiners set as distractors
- Verification strategy: Develop a quick method to check your answer
Related Topics
- Previous Topic â Build on the foundation laid here
- Next Topic â See how this concept extends to more advanced material
- Practice Problems â Additional exercises with solutions
- Video Explanation â Visual walkthrough of key concepts
Quick Reference Card
| Concept | Formula/Rule | Key Insight | Common Use |
|---|---|---|---|
| Core Definition | See main text | Understand the intuition | Foundation for all applications |
| Key Formula | See main text | Memorize the derivation | Direct problem solving |
| Special Case | See main text | Recognize when it applies | Simplifies complex problems |
| Edge Case | See main text | Know the limitations | Avoids errors |
Further Reading
For students who want to go deeper:
- Standard textbooks on the subject
- Research papers applying this concept
- Online courses with video explanations
- Practice problem collections with detailed solutions