A/B Testing: Design and Interpret a Reliable Experiment
Plan a randomized product comparison by defining the unit, hypothesis, metrics, sample, and stopping rules; then check data quality and interpret effect size and uncertainty before deciding whether to ship.
A/B testing is an experiment that randomly assigns eligible participants to the current experience (A) or one changed experience (B), then compares a pre-defined outcome to estimate the average effect of assigning the change. Random assignment reduces the chance that pre-existing differences systematically favour one group, but it does not fix missing data or a poorly defined metric. A trustworthy test must specify who is assigned to which unit, what outcome is measured and for how long, and how the team will check that the results can be trusted.
What question does an A/B test answer?
The central question is: “For this eligible population, how much does assigning B change a pre-defined outcome compared with assigning A?” The effect is usually estimated as the difference in average outcomes between groups, based on their randomized assignment. That is different from selecting only people who actually saw B and comparing them with A. Exposure or use can be decided after assignment, so comparing only exposed people can break the original randomization.
As far as possible, A and B should differ in just the intended change. If the title, price and layout all change at once, it becomes hard to tell which element produced a difference. Testing multiple elements and their interactions requires a factorial or multivariate design, with different design, sample and interpretation needs from a simple two-version comparison. Microsoft’s online experimentation checklist recommends checking the hypothesis, design, metrics, data collection, minimum effect to detect, test duration and randomization quality before starting. This is the practice of that research group, not a universal rule for every organization. Microsoft’s online experimentation checklists
Fix the design before starting
First turn the decision into a testable hypothesis. For example: “Showing the expected delivery date earlier on the checkout page will increase the share of eligible users who complete a purchase within seven days, without raising the payment-error rate beyond an acceptable range.” A statement such as “the experience will be better” does not say what evidence could support or refute it.
Next choose the randomization unit. If one person switches between devices, an account may be a more consistent unit than a visit session. If people in a team or business affect one another, an organization-level unit may be needed. Assigning interacting people to different versions can create interference: one group’s experience changes the other group’s outcome. The unit should also match how the metric is aggregated. If users are randomized but repeated page views are treated as independent observations, uncertainty can be understated.
Write down who is eligible: country, device, new or returning user, or eligibility to see a feature. Fix inclusion and exclusion rules before assignment. Be careful about using “people who actually used the feature” as a condition after the test starts, because the change itself may affect usage. Record exposure and events using the same rules in both versions, and decide how to handle missing, duplicate or delayed events.
Give metrics distinct roles instead of collapsing the outcome into one win/loss number.
| Metric role | Checkout example | What to define |
|---|---|---|
| Primary success metric | Share of assigned eligible accounts that purchase within seven days | Decide in advance whether the denominator is all assigned accounts or only exposed accounts |
| Feature metric | Share that starts checkout after seeing the delivery date | Check whether the change worked in the intended path |
| Guardrail metric | Payment-error rate, cancellation rate, page response time | Check that a higher success metric does not come with substantial harm to users or the service |
| Data-quality metric | Assignment counts, exposure logging rate, missing or duplicated purchase events | Check whether the other metrics can be trusted |
The primary success metric should connect to the long-term outcome the change is meant to improve. Feature use or clicks can help diagnose the path, but more clicks can coexist with fewer purchases or less user value. A guardrail is not necessarily a metric that must improve; it checks whether a harm limit has been crossed. Microsoft’s guidance also recommends designing success, feature, guardrail and data-quality metrics together. Microsoft guidance on metric design
Choose a meaningful effect and plan the sample
Do not choose a sample size by saying “more is better.” First decide what minimum effect would be valuable enough to change the decision. This is the minimum detectable effect (MDE): the smallest metric change the planned sample and test can find with a stated probability. Planning depends on the baseline conversion rate, effect size, significance level, power, allocation between groups and metric variability. Power is the chance of detecting a specified effect when it is truly present. With low power, even a worthwhile improvement may remain uncertain. Microsoft describes MDE as the smallest metric movement detectable with high probability for a given sample and power; a smaller MDE may require more observations, so compare the baseline rate with the experiment duration you can support. Microsoft on metric sensitivity and MDE NIST’s sample-size guidance likewise shows that a baseline proportion, detectable difference, significance level and desired power affect the number of observations needed. NIST guidance on sample size for proportions
Do not set the duration from data volume alone. Consider weekday, payday, seasonal and campaign cycles, as well as how long participants need to experience the outcome. Set the target sample and stopping conditions before the experiment starts. If you repeatedly inspect results and stop as soon as a p-value first falls below 0.05, you may fail to account for the error created by repeated looks. Separately define safety conditions that justify stopping early because of user harm or system risk. If early statistical stopping is allowed, use a procedure designed for it, such as a suitable sequential test. “Stop when it becomes significant” is not an adequate rule. Microsoft’s experiment analysis checklist
Check assignment and measurement before analysing effects
After launch, check data quality before interpreting results. If the configured allocation is, for example, 50% A and 50% B, test for a sample ratio mismatch (SRM) when the observed assignment counts differ substantially. Looking at the percentages by eye is not enough. With a large sample, even a small difference may matter, so use a statistical check that accounts for the configured allocation and sample size.
An SRM is a warning sign, not a diagnosis. Possible causes include faulty user identity, exposure or log loss that differs by version, event-join problems, filters applied after assignment, or an incorrect eligibility condition. In a Microsoft case, a change drew more users into the experience, but a bot-detection rule then removed many of those users from the analysis. Investigating the SRM reversed the interpretation. Therefore, hold off on effect analysis and launch decisions until the mismatch is understood and resolved. Microsoft’s guide to diagnosing SRM
Also check missing, duplicated or delayed data, event-definition differences, failed delivery of a version, and sharp declines in guardrails. For a change that can be safely rolled back, starting with a small traffic share and increasing exposure gradually can limit harm. A gradual rollout does not replace randomized comparison or a pre-specified sample and analysis plan. Microsoft recommends examining day-by-day changes and guardrails to detect novelty effects, one-day events and reactions that do not persist. Microsoft guidance for monitoring during an experiment
Hypothetical example: did showing delivery dates increase purchases?
The following is a hypothetical example for explaining the calculations, not data from a real service. Suppose eligible user accounts are randomly assigned to A or B. A shows the existing checkout page; B shows the expected delivery date earlier. The primary metric is the share of assigned accounts that complete a purchase within seven days.
| Version | Randomly assigned accounts | Accounts that purchased within seven days | Purchase rate |
|---|---|---|---|
| A: current page | 1,000 | 40 | 4.0% |
| B: delivery date shown | 1,000 | 50 | 5.0% |
The observed difference is 1.0 percentage point; relative to A, the increase is 25%. These are different descriptions. Saying only “up 25%” can hide the absolute change from 4% to 5%. An Agresti–Caffo adjusted 95% confidence interval for the difference between the two proportions is approximately -0.8 to +2.8 percentage points. This method addresses one limitation of the simple Wald interval, whose actual coverage can fall below its stated level, but it remains an approximation. Original Agresti–Caffo paper on confidence intervals for two proportions Because the interval includes zero, this sample alone does not establish a clear positive effect; it also does not prove that there is no effect. Separately check assignment counts, purchase events and payment-error rates.
After seeing these results, do not collect an arbitrary number of extra observations. Check the target sample and stopping rule set before the experiment. If the target was not met, a follow-up test or a more sensitive metric may be planned using the observed effect and uncertainty, as allowed by the pre-specified plan. If a guardrail worsened or an SRM is unresolved, hold the launch even if the primary metric looks higher.
Report the effect and decide whether to ship
Report each group’s size, the primary metric and denominator, the outcomes for A and B, absolute and relative changes, a confidence interval or other suitable uncertainty measure, data quality, guardrails and analysis scope. A p-value is one measure of how compatible the data are with a specified statistical model and its assumptions; it is not the probability that a hypothesis is true, nor the size or business importance of the effect. Online experiment reports describe cases where choosing a winner from a metric movement or p-value alone produced interpretation errors. Microsoft Research on metric interpretation pitfalls The American Statistical Association also says that scientific or business decisions should not rest on one p-value threshold and that effect size and transparent reporting matter. ASA statement on p-values
Frame the practical decision conditionally:
If assignment and data quality are sound, the pre-defined success metric improves by a meaningful amount, and guardrails remain within bounds, consider rollout to the same eligible population and conditions.
If the result is uncertain and the target sample was not reached, gather more data within the pre-specified plan or design another experiment. Do not change the analysis after seeing the results just to cross a threshold.
If adequate power rules out an effect large enough to justify the change, or a guardrail shows harm, do not ship the current change as-is; investigate or test a revised version.
If many groups are examined and only the best-looking one is chosen, a chance difference may be mistaken for a discovery. Pre-specify subgroup hypotheses or label subgroup findings as exploratory and validate them separately.
Random assignment provides a basis for estimating the effect of assignment, but the conclusion is limited to the tested population, assignment unit, measured outcome and time period. Long-term retention, generalization to other countries, devices or user groups, and interactions between groups require separate checks. A good A/B result does not simply mean B had a higher number: it means there is credible evidence of a decision-relevant difference under trustworthy assignment and measurement, and that the expected benefit outweighs risks to users and the service.