Hypothesis Tests and P-Values
Set up null and alternative hypotheses, interpret p-values correctly, balance Type I and Type II errors, and separate statistical from practical significance.
Welcome back!
Step 1 of 14Learn
Real effect or lucky week?
An online store changes the color and wording of its checkout button. In the following two weeks, the conversion rate rises from 5.0% to 5.4%. The designer wants credit. The skeptical analyst asks: how often would a 0.4-point jump happen anyway, with no real effect, just from the usual week-to-week noise?
That question is the heart of a hypothesis test. It works like a courtroom. The defendant, the new button, is presumed to have no effect until the evidence is strong enough to reject that presumption. The default position is called the null hypothesis (H₀): here, "the new button does not change the conversion rate". The claim you are testing is the alternative hypothesis (H₁): "the conversion rate is different with the new button".
You then ask how surprising the observed data would be if the null hypothesis were true. If the data would be very unusual under "no effect", you reject the null and conclude there is evidence of an effect. If it would be fairly ordinary, you don't reject it, which is not the same as proving that there is no effect.
This lesson covers the logic and the vocabulary: p-values, significance levels, the two kinds of errors and power. The next lesson applies them to concrete comparisons, and Module 4 turns them into a complete A/B testing process.
Step 2 of 14Learn
What a p-value is
The p-value is the probability of getting a result at least as extreme as the one you observed, assuming the null hypothesis is true.
If the checkout button test gives p = 0.03, it means: if the button truly made no difference, results showing a gap this large or larger would happen only about 3% of the time by chance. That is fairly unusual, so it counts as evidence against the null hypothesis.
To make a decision, analysts set a significance level α in advance, most commonly 0.05. If p ≤ α, the result is called statistically significant and the null is rejected. If p > α, the null is not rejected.
The p-value is computed from a test statistic, which measures how far the observed result is from what the null predicts, in standard errors. A z or t statistic of about 2 corresponds to a two-sided p-value near 0.05; a statistic of 3 gives about 0.003.
Two-sided tests ask whether there is a difference in either direction; one-sided tests ask about only one direction. Use two-sided tests unless a change in the other direction would truly be irrelevant and you decided that before seeing the data. Switching to a one-sided test after seeing the results halves the p-value, which is a quiet form of cheating.
Step 3 of 14Practice · Choose one
A test of a new pricing page gives p = 0.04. Which statement is a correct interpretation?
Step 4 of 14Diagram
The logic of a hypothesis test
A test is an argument by contradiction. Tap each step.
Tap a shape with to see more.
- Assume no effect
The null hypothesis: the new button changes nothing.
- Collect the data
Conversion went from 5.0% to 5.4%.
- How surprising under the null?
The p-value: the chance of a difference at least this big if there were truly no effect.
- Compare with α
Small p: the data are hard to explain by chance alone, so reject the null. Large p: not enough evidence either way.
Step 5 of 14Learn
Two kinds of errors and the idea of power
Any decision rule can go wrong in two ways:
| Null is true (no effect) | Null is false (real effect) | |
|---|---|---|
| Reject null | Type I error (false positive) | Correct detection |
| Don't reject | Correct | Type II error (false negative) |
The Type I error rate is α. With α = 0.05, when there truly is no effect, you will wrongly declare one about 5% of the time. The Type II error rate is called β, and power = 1 − β is the probability of detecting an effect that really exists. A common target is 80% power.
The two errors trade off. Lowering α to 0.01 makes false positives rarer but makes real effects harder to detect, lowering power. The way to reduce both at once is more data, or less noisy data.
Power depends on three things: the sample size (more data, more power), the size of the effect (big effects are easy to spot) and the noise in the data (less variability, more power). An underpowered study is a common and expensive mistake: a test with 30% power will miss a real improvement 70% of the time, and the team concludes "it didn't work" when the test simply couldn't tell. Worse, when an underpowered test does reach significance, the estimated effect tends to be exaggerated, because only the luckiest results cross the line.
Step 6 of 14Practice · Match the pairs
Match each situation to the correct term.
Tap an answer, then tap the place where it belongs (or drag it there).
- A test declares that a new feature increased sign-ups, but in truth it had no effect
- A test finds no significant effect of a change that really did improve retention
- The probability of detecting a real effect of a given size
- The false positive rate you accept in advance, often 0.05
Step 7 of 14Practice · Diagram
Four possible outcomes of a test
The decision you make (rows) against the truth you cannot see (columns).
Tap the outcome where a team ships a change that truly has no effect.
Tap the shape that answers the question, then press Check.
- Type I error: false positive
You ship a change that does nothing.
- Correct detection
The probability of landing here when an effect exists is the test's power.
- Correct: nothing found
No effect, and the test agrees.
- Type II error: false negative
A real improvement is missed and abandoned.
Step 8 of 14Learn
What p-values do not tell you
P-values are among the most misunderstood numbers in data analysis. Keep these points in mind:
- A p-value is not the probability that the null hypothesis is true. It is computed by assuming the null is true.
- A p-value does not measure the size or importance of an effect. With a huge sample, a trivial difference, such as a conversion rate of 5.00% versus 5.02%, can produce p < 0.001. With a tiny sample, a large and valuable effect can produce p = 0.3. Always report the effect size with a confidence interval.
- p > 0.05 does not prove there is no effect. It means the data is not strong enough to rule out no effect. The confidence interval shows what effects remain plausible; an interval from −0.2 to +1.5 points includes both zero and a big gain.
- The 0.05 line is a convention, not a law of nature. p = 0.049 and p = 0.051 are practically the same evidence.
- P-values assume you ran one planned test. Testing many metrics, segments or stopping points and reporting the best inflates false positives, as you'll see in the A/B testing module.
The most useful habit is to separate statistical significance (is the effect distinguishable from noise?) from practical significance (is it big enough to matter for the business?). A result needs both before it justifies action.
Step 9 of 14Practice · Select all that apply
Which statements are correct? Select all that apply.
Select all that apply.
Step 10 of 14Note
Step 11 of 14Practice · Work it out
A team runs 100 independent tests of changes that, in truth, have no effect at all. Each test uses α = 0.05. How many of them would you expect to come out statistically significant?
Step 12 of 14Chart
100 tests of changes that do nothing
| Item | Tests |
|---|---|
| Significant by chance | 5 |
| Correctly not significant | 95 |
Step 13 of 14Practice · What would you do?
What would you do?
A large retailer tests a new product-page layout on 2 million visitors per group. Conversion is 3.10% with the old layout and 3.12% with the new one, with p = 0.01. Rebuilding all product pages would take a team three months. What should you conclude?
Step 14 of 14Practice · True or false
Holding everything else equal, increasing the sample size increases the power of a test.
Lesson complete!