# A/B Testing and Experiment Design

> Designing, sizing, running and analysing controlled experiments so product and marketing decisions rest on causal evidence. Free notes, key concepts, resources...

Canonical: https://www.internhack.in/roadmaps/tracks/data-analyst/ab-testing
Last updated: 2026-11-28

Designing, sizing, running and analysing controlled experiments so product and marketing decisions rest on causal evidence.

Intermediate · about 6 hours · difficulty 3/5

Learn first: [Hypothesis Testing and p-values](https://www.internhack.in/roadmaps/tracks/data-analyst/hypothesis-testing)

An A/B test randomly splits users between a control and one or more variants, then compares outcomes. Randomisation is what lets you claim causality.

### Before launch

- **Hypothesis and primary metric**: one metric decides the test; others are guardrails (e.g. refunds, page load time).
- **Unit of randomisation**: user, session, account, or region. Randomise at the level where the effect happens.
- **Minimum detectable effect and sample size**: decide the smallest lift worth detecting, then compute required sample size for your power (often 80%). Online calculators make this quick.
- **Duration**: run whole weeks to cover weekday patterns; fix the end date in advance.

### During the test

- Check **sample ratio mismatch**: if you expected 50/50 and got 52/48 with large numbers, something is broken.
- Avoid **peeking**: repeatedly checking and stopping at the first significant result inflates false positives. Use fixed horizons or sequential methods designed for peeking.

### Analysis

- Compare the primary metric with a confidence interval for the difference.
- Look at guardrails and a few pre-planned segments; treat unplanned segment wins as hypotheses for a new test.
- Watch for **novelty effects** and network effects where users influence each other.

**Pitfall:** declaring "no difference" from an underpowered test. Absence of evidence is not evidence of absence. Move on when you can write a complete test plan including sample size and decision rule.

## Key concepts

- **Randomisation and control groups**
- **Primary and guardrail metrics**
- **Sample size and minimum detectable effect**
- **Sample ratio mismatch**
- **Peeking and sequential testing**
- **Segment analysis without p-hacking**
- **Novelty and network effects**
- **Bayesian A/B testing**

## Mini project

Analyse the public Kaggle 'Cookie Cats' mobile game A/B test dataset: check sample ratio, compare day-1 and day-7 retention between variants with confidence intervals, and write a launch recommendation.

## Check yourself

Why does stopping a test as soon as p drops below 0.05 increase your false positive rate?

## Free resources

- [Evan Miller's A/B testing tools](https://www.evanmiller.org/ab-testing/) (Evan Miller)
- [OpenIntro Statistics](https://www.openintro.org/book/os/) (OpenIntro)
- [Kaggle Learn](https://www.kaggle.com/learn) (Kaggle)

Previous: [Linear and Logistic Regression for Analysts](https://www.internhack.in/roadmaps/tracks/data-analyst/regression-basics) · Next: [SQL Basics: SELECT, WHERE, ORDER BY](https://www.internhack.in/roadmaps/tracks/data-analyst/sql-select-filter)

## More in Statistical Thinking for Decisions

- [Descriptive Statistics](https://www.internhack.in/roadmaps/tracks/data-analyst/descriptive-statistics)
- [Probability and Distributions](https://www.internhack.in/roadmaps/tracks/data-analyst/probability-distributions)
- [Sampling, Bias and Data Collection](https://www.internhack.in/roadmaps/tracks/data-analyst/sampling-and-bias)
- [Estimation and Confidence Intervals](https://www.internhack.in/roadmaps/tracks/data-analyst/confidence-intervals)
- [Hypothesis Testing and p-values](https://www.internhack.in/roadmaps/tracks/data-analyst/hypothesis-testing)
- [Correlation, Causation and Confounding](https://www.internhack.in/roadmaps/tracks/data-analyst/correlation-causation)
- [Linear and Logistic Regression for Analysts](https://www.internhack.in/roadmaps/tracks/data-analyst/regression-basics)
- [A/B Testing and Experiment Design](https://www.internhack.in/roadmaps/tracks/data-analyst/ab-testing)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Data Analyst Roadmap](https://www.internhack.in/roadmaps/tracks/data-analyst)
