---
title: "How to Analyze A/B Test Results: Significance and Sample Size"
url: "https://goremy.ai/blog/articles/how-to-analyze-an-a-b-test-significance-sample-size-and-ai-checks"
author: Luis Chavez-Mattos
editor: Luis Chavez-Mattos
editor_title: Director, Product
published: "2026-12-02T19:40:16.515Z"
updated: "2026-12-02T19:40:16.515Z"
topic: SQL and Data Analysis
description: "How to analyze A/B test results: check data quality, test significance, read confidence intervals, size samples, and use AI to catch mistakes."
---

# How to Analyze A/B Test Results: Significance and Sample Size

> How to analyze A/B test results: check data quality, test significance, read confidence intervals, size samples, and use AI to catch mistakes.

Edited by Luis Chavez-Mattos, Director, Product · Published 2026-12-02

## How do you analyze A/B test results?

You analyze an A/B test in five checks: confirm the data is clean (including that traffic split the way you intended), compare the two groups on the one metric you chose before the test started, calculate a p-value and a confidence interval for the difference, check that the test had enough sample size to detect a meaningful change, and then decide based on the size of the effect, not only on whether p is below 0.05. A test "wins" when the confidence interval for the lift is credibly above zero and above the minimum change that matters to the business.

This guide walks through each step with a worked example, working code, and prompts for using AI as a second reviewer.

## TL;DR

- **Check the data before you check the result.** A sample ratio mismatch (traffic split that does not match the design) invalidates a test no matter how good the p-value looks.
- **Use the metric and stopping rule you wrote down before launch.** Choosing the metric or the end date after seeing the data inflates false positives.
- **Report a confidence interval, not only a p-value.** The interval shows how large the effect could plausibly be, and that is what the decision rests on.
- **"Not significant" does not mean "no effect."** It often means the test was too small to tell, so check what size of lift it could actually detect.
- **Sample size comes from four inputs:** baseline rate, smallest lift worth detecting, significance level, and power. Calculate it before launch, not after.
- **AI is a good reviewer and a poor calculator.** Have it audit your reasoning and write code, then run the numbers yourself.

## What do you need before you start analyzing?

Pull these items before touching a p-value. If any is missing, the analysis is already weaker.

- **The hypothesis and primary metric**, written before launch. One primary metric (for example, checkout conversion rate), plus a short list of guardrail metrics (refund rate, page load time, unsubscribe rate) that must not get worse.
- **The unit of randomization.** Was it assigned by user, session, or device? You must analyze at that same unit. If users were randomized but you count sessions, repeated visits from the same person make results look more certain than they are.
- **The planned sample size and run length**, and the date range actually run.
- **Per-group counts:** users exposed (not users assigned who never saw the change), and conversions or the metric total.
- **Any known incidents** during the test: outages, a marketing campaign, a pricing change, a tracking bug.

## Step 1: How do you check data quality and sample ratio?

The most common reason a test result is wrong is not statistics. It is broken data. Run these checks first.

**Sample ratio mismatch (SRM).** If you designed a 50/50 split, you should see close to 50/50 in the data. A chi-square goodness-of-fit test tells you whether the deviation is bigger than chance.

Example: you designed 50/50 and 20,000 users entered. You see 10,300 in control and 9,700 in the variant. Expected is 10,000 each. The chi-square statistic is (300² / 10,000) + (300² / 10,000) = 18, which corresponds to a p-value far below 0.001. That is not random. Something in assignment, logging, or redirects is broken, and you should not read the conversion results at all until you find out what.

```python
from scipy.stats import chisquare

observed = [10300, 9700]
expected = [10000, 10000]
stat, p = chisquare(observed, expected)
print(stat, p)
```

Many teams use a strict threshold for SRM (such as p below 0.001) because it is a diagnostic, not a business decision.

**Other checks:**

- **Duplicate or bot traffic.** Filter internal traffic and known bots the same way for both groups.
- **Exposure logging.** Count users who actually saw the experience, not everyone assigned. A variant that loads slowly can log fewer exposures and create an SRM on its own.
- **Run length covers full cycles.** If your business has weekly patterns, run in whole weeks so weekday and weekend behavior are balanced.
- **Novelty and primacy effects.** Plot the daily difference. If the lift is large on day one and decays toward zero, the early number overstates the long-run effect.

## Step 2: How do you compare the groups on the pre-registered metric?

Compute the metric for each group. For a conversion rate, that is conversions divided by users.

Here is the worked example used for the rest of this guide:

| Group | Users | Conversions | Conversion rate |
|---|---|---|---|
| Control | 10,000 | 500 | 5.0% |
| Variant | 10,000 | 560 | 5.6% |

The absolute difference is 0.6 percentage points. The relative lift is 12% (0.6 divided by 5.0). It looks like a win. Now test whether it is distinguishable from noise.

## Step 3: How do you test significance and compute a confidence interval?

For two conversion rates, the standard approach is a two-proportion z-test.

**What the numbers mean:**

- **The null hypothesis** says the two groups have the same true conversion rate.
- **The p-value** is the probability of seeing a difference at least this large if the null were true. It is not the probability that the variant is better.
- **The significance level (alpha)**, usually 0.05, is the false-positive rate you agreed to accept.

Calculating by hand for the example: the pooled rate is 1,060 / 20,000 = 5.3%. The standard error of the difference is about 0.00317. The z-score is 0.006 / 0.00317, about 1.89. The two-sided p-value is about 0.058.

In Python:

```python
from statsmodels.stats.proportion import proportions_ztest, confint_proportions_2indep

counts = [560, 500]      # variant, control
nobs = [10000, 10000]

z, p = proportions_ztest(counts, nobs)
print("z =", z, "p =", p)

low, high = confint_proportions_2indep(560, 10000, 500, 10000, compare="diff")
print("95% CI for difference:", low, high)
```

The 95% confidence interval for the difference is roughly -0.02 to +1.22 percentage points.

**How to read that result:** the p-value of 0.058 is just above 0.05, so by the usual rule this is not statistically significant. The interval tells the fuller story. The data are compatible with no effect at all, and also with a lift of more than a full percentage point. The honest summary is "inconclusive, leaning positive," not "the variant lost" and not "the variant won."

**Which test for which metric:**

| Metric type | Example | Typical method |
|---|---|---|
| Rate (yes/no per user) | Conversion, click-through | Two-proportion z-test, or chi-square |
| Mean of a continuous value | Revenue per user, time on page | Welch's t-test; consider bootstrap for skewed data |
| Ratio of totals | Revenue per session | Delta method or bootstrap, analyzed at the randomization unit |
| Time to event | Days to first purchase | Survival analysis |

Revenue per user is usually heavily skewed (many zeros, a few large buyers). A t-test can still be reasonable with large samples, but check for outliers, consider capping extreme values using a rule set in advance, and compare against a bootstrap interval.

## Step 4: How do you check whether the test had enough power?

Our example was not significant. Before you call it a failure, ask what the test could detect. This is where sample size comes in.

**Sample size depends on four inputs:**

1. **Baseline rate** (here, 5%).
2. **Minimum detectable effect (MDE):** the smallest lift worth acting on.
3. **Significance level** (usually 0.05, two-sided).
4. **Power** (usually 80%): the chance of detecting the effect if it is real.

For a 5% baseline, a 10% relative lift (5.0% to 5.5%), alpha of 0.05 and 80% power, you need roughly 31,000 users per group. Our test had 10,000 per group. At that size, the test could reliably detect only a relative lift of around 17 to 18 percent. A real 10% improvement would often have been missed. That is why "not significant" here means "underpowered," not "no effect."

```python
from statsmodels.stats.power import NormalIndPower
from statsmodels.stats.proportion import proportion_effectsize

effect = proportion_effectsize(0.055, 0.05)
n = NormalIndPower().solve_power(effect_size=effect, alpha=0.05, power=0.8, ratio=1)
print(round(n))
```

The output will be close to the 31,000 figure (different formulas differ by small amounts).

**Rules that keep sample size honest:**

- Decide the MDE from the business, not from what is easy to reach. Ask what lift would justify the cost of shipping and maintaining the change.
- Low baseline rates and small MDEs need much larger samples. Halving the MDE roughly quadruples the sample.
- If you cannot reach the needed sample in a reasonable time, test a bolder change, pick a more sensitive metric, or accept that you can only detect large effects.

## Step 5: How do you avoid the mistakes that create false winners?

**Peeking.** Checking the p-value daily and stopping the first time it dips below 0.05 raises the false-positive rate well above 5%. Either fix the sample size and look once, or use a sequential method designed for repeated looks (your experimentation platform may offer one).

**Multiple comparisons.** If you test five variants, or slice one test by ten segments, some will look significant by chance. Adjust the threshold (Bonferroni is the simple, conservative option) or treat segment findings as hypotheses for a follow-up test.

**Switching the metric.** If the primary metric is flat but a secondary metric moved, that is a lead, not a win.

**Confusing statistical and practical significance.** With enough traffic, a 0.05% lift can be "significant." Compare the interval to the cost and the business value.

**Ignoring guardrails.** A conversion lift paired with a rise in refunds or support contacts may be a loss.

**Simpson's paradox and uneven segments.** If the mix of mobile and desktop users differs between groups (it should not under proper randomization, but logging bugs happen), aggregate results can mislead. Check the split by major segments.

## Step 6: How do you make the decision?

Translate the interval into one of a few outcomes.

| What the confidence interval shows | Reasonable decision |
|---|---|
| Entirely above your MDE | Ship. |
| Above zero but straddling your MDE | Likely positive; ship if the change is cheap and reversible, otherwise extend the test. |
| Straddles zero, narrow | No meaningful effect. Stop and move on. |
| Straddles zero, wide (our example) | Inconclusive. Extend to the planned sample size, or rerun with more traffic. |
| Entirely below zero | The variant hurts. Do not ship. |
| Primary metric fine but a guardrail worsens | Investigate before shipping. |

For our example the right message to stakeholders is: "The variant is 0.6 points ahead (5.6% vs 5.0%), but the test was too small to be conclusive (p = 0.06, interval from about -0.02 to +1.22 points). We need roughly 31,000 users per group to detect a 10% lift. We recommend continuing to that sample size." That is more useful than "not significant."

## How can AI help you analyze an A/B test?

AI is useful in three places: writing the analysis code, auditing your design for mistakes, and drafting the plain-language summary. It is unreliable as the thing that does the arithmetic, so run the calculations in code and use AI to check your thinking.

**Prompt 1: audit the test design and results.** Paste this with your numbers (no personal data, only aggregates).

```
You are a careful experimentation analyst. Review this A/B test and tell me
what could make the conclusion wrong. Do not just compute a p-value.

Design:
- Hypothesis: [text]
- Primary metric: [metric], guardrails: [list]
- Unit of randomization: [user/session/device]
- Planned split: [e.g. 50/50]
- Planned sample size per group: [n] and planned duration: [days]
- Actual dates run: [dates]; known incidents: [list or none]

Results:
- Control: [users exposed], [conversions or metric total]
- Variant: [users exposed], [conversions or metric total]

Do the following:
1. Check for sample ratio mismatch and show the calculation.
2. Pick the right test for this metric and say why.
3. Give the effect size, a 95% confidence interval, and the p-value.
4. State what minimum effect this sample could detect at 80% power.
5. List any peeking, multiple comparison, or metric-switching risks you see
   from my description.
6. Give a recommendation: ship, stop, or extend, with one sentence of reasoning.

Show formulas and flag any assumption you are making.
```

**What to check in the answer:**

- Recompute the p-value and interval yourself with the code above. Language models make arithmetic errors, especially with small proportions.
- Confirm it used the right unit. If it analyzed sessions as independent when users were randomized, the interval will be too narrow.
- Check that it did not invent a threshold or "industry standard" you did not give it.
- Be skeptical of a confident "ship it" when the interval straddles zero.

**Prompt 2: generate the analysis code.**

```
Write Python (pandas, scipy, statsmodels) that takes a CSV with columns
user_id, group ("control" or "variant"), converted (0/1). It should:
- check for duplicate user_ids
- run an SRM chi-square test against a 50/50 split
- compute conversion rate per group, absolute and relative lift
- run a two-proportion z-test and a 95% confidence interval for the difference
- report the minimum detectable effect for this sample size at 80% power
Print a short readable summary. Add comments explaining each step.
```

Read the code before running it, and test it on the 10,000 / 500 / 560 example above. If it does not return a p-value near 0.058, something is wrong.

**Prompt 3: write the summary for non-analysts.**

```
Turn these results into a 4-sentence summary for a product manager who does
not know statistics. Include the result, how sure we are, what we recommend,
and what would change the recommendation. Avoid the terms "null hypothesis"
and "significant" without explanation. Results: [paste numbers]
```

**Where not to trust AI:**

- **Real data you cannot share.** Do not paste user-level or customer data into a public AI tool. Use aggregates, or run the code locally.
- **Mid-test decisions.** AI will happily tell you a p-value of 0.04 on day three is a win. It does not know you peeked unless you say so.
- **Business context.** It cannot tell you whether a 0.3-point lift justifies the engineering cost.
- **Cited statistics.** If it quotes benchmark conversion rates or "typical" lifts, treat them as unverified.

## Could you build your own experiment tracker instead of using spreadsheets?

Most teams that run tests regularly end up with a spreadsheet of past experiments: hypothesis, dates, sample size, result, decision. It drifts out of date, and nobody can tell which tests were planned or peeked at. With [Remy](https://goremy.ai), you can describe an internal experiment log in plain English and have it built and deployed as a full-stack app: a form to register each test before launch (metric, MDE, planned sample size), a results page that runs the SRM and significance checks on uploaded counts, and a searchable archive with sign-in for your team. The app is standard TypeScript in a git repo you own, so your analysts can review and change it.

## Frequently Asked Questions

### What p-value counts as a significant A/B test result?

Most teams use 0.05, meaning they accept a 5% chance of a false positive. It is a convention, not a law. Choose the threshold before the test based on the cost of a wrong call, and report the confidence interval alongside it.

### How long should I run an A/B test?

Run it until you reach the sample size you calculated in advance, and in whole weekly cycles so weekday and weekend behavior are balanced. Do not stop early because the result looks good. If traffic is too low to reach the needed sample in a reasonable time, test a larger change.

### What if my A/B test result is not significant?

It means the data do not rule out "no effect," not that there is none. Look at the confidence interval and the minimum effect your sample could detect. If the interval is narrow around zero, move on. If it is wide, the test was underpowered and needs more data or a bolder variant.

### Should I use a Bayesian or frequentist analysis?

Both work when used correctly. Frequentist tests (p-values, confidence intervals) are the standard and are what this guide uses. Bayesian methods give a probability that the variant is better and handle repeated looks more naturally, but they require choosing priors and still need clean data and a sensible decision threshold.

### Can I trust AI to tell me whether my test won?

Trust it to review your design, write code, and explain results. Do not trust it to be the calculator or the decision maker. Run the statistics in code, verify the numbers against a known example, and keep the final call with someone who understands the business context.
