Lesson 1
The logic of hypothesis testing
You will be able to state a null and alternative hypothesis for an A/B test and describe the two types of error. Covers the concept of a test statistic, the sampling distribution under the null, and the intuition behind the p-value. Prevents treating a non-significant result as proof of no effect.
You've run an A/B test for a week. Variant B shows a 2% higher conversion rate than the control. Is that real improvement, or could it be just random noise? Hypothesis testing gives you a disciplined way to decide — with a known risk of being wrong.
The core idea is simple: assume nothing has changed, then see if your data is too extreme to fit that assumption. The assumption of 'no real difference' is called the null hypothesis (H₀). For an A/B test, H₀ might state: 'the true conversion rate of variant B equals that of variant A' (or the difference is zero). The alternative hypothesis (H₁) is what you're trying to prove: 'the two rates are different' (for a two-sided test) or 'B is better' (one-sided).
You collect data and compute a test statistic — a single number that summarizes the difference between groups, such as the difference in conversion rates. Now the question: if H₀ were true, how likely would you be to see a test statistic as extreme as the one you observed? The answer comes from the sampling distribution under the null: the distribution of the test statistic if the null were true and you repeated the experiment many times. This distribution is derived from probability theory (often the normal distribution via the Central Limit Theorem) or from simulation.
The p-value is the probability, under the null distribution, of getting a test statistic at least as extreme as what you observed. A small p-value (below your chosen significance level α, typically 0.05) means your data is unlikely under H₀ — you reject H₀ in favor of H₁. If the p-value is not small, you fail to reject H₀. Crucially, you never 'accept' H₀; you only conclude that the evidence is insufficient to discard it.
Two types of error can occur. A Type I error (false positive) is rejecting H₀ when it's actually true — you claim a lift that doesn't exist. The significance level α is the probability of a Type I error you're willing to tolerate. A Type II error (false negative) is failing to reject H₀ when H₁ is true — you miss a real effect. The probability of a Type II error is β, and power = 1 − β is the probability of detecting a real effect. These errors trade off: to reduce one, you usually increase the other, unless you increase sample size.
Hypothesis testing decision process and the two types of error. The p-value is compared to the significance level α to decide whether to reject the null hypothesis.
Hypothesis testing is like a criminal trial. The null hypothesis is 'the defendant is innocent'. The evidence is the data you collect. The jury's verdict is the decision: 'guilty' (reject H₀) if the evidence is strong enough beyond reasonable doubt, or 'not guilty' (fail to reject H₀) if the evidence is insufficient. The significance level α corresponds to the standard of proof: a stricter court demands stronger evidence to convict, just as a lower α requires a smaller p-value. A Type I error is convicting an innocent person; a Type II error is acquitting a guilty person.
Where the analogy breaks down
In a criminal trial, the consequences of Type I and Type II errors are extremely asymmetric: convicting an innocent person is considered far more harmful than acquitting a guilty one. In hypothesis testing, the researcher chooses α and β deliberately, often balancing them so that both error types are acceptable, and can adjust the trade-off by changing sample size or design. Also, a 'not guilty' verdict does not mean the person is innocent, but the legal system treats it as a final state; in testing, a non-significant result is never proof of H₀ — you simply lack evidence against it.
Watch the short video for a visual, intuitive walkthrough. Then read the textbook chapter for a thorough, step-by-step breakdown of the hypothesis testing process, including the logic of the null distribution and the meaning of the p-value. Note how the video and chapter reinforce the same ideas — the video builds intuition, the chapter formalizes it.
“A p-value of 0.03 means there is only a 3% chance that the null hypothesis is true.”
A small p-value leads to rejecting the null, so it feels like the null is unlikely. The intuition 'if the data is rare under the null, then the null is probably false' is a natural but incorrect reversal of conditional probability.
What is actually true
The p-value is the probability of observing data as extreme as yours (or more) given that H₀ is true — written P(data or more extreme | H₀). It is not the probability that H₀ is true given the data — that would be P(H₀ | data), a quantity that depends on prior beliefs and requires Bayes' theorem. Confusing these two probabilities is the most common error in interpreting statistical results, and it leads directly to overconfidence in findings.
Check your understanding of the logic behind hypothesis testing.
Which statement correctly describes the null hypothesis in an A/B test comparing conversion rates?
- AThe null hypothesis states that there is a meaningful difference between the variants.
- BThe null hypothesis states that the observed difference is due to chance and there is no real difference.
- CThe null hypothesis states that variant B is better than variant A.
- DThe null hypothesis states that the experiment is designed correctly.
An e-commerce company runs an A/B test to see if a new checkout button increases the purchase rate. They set α = 0.05 and after collecting data they get a p-value of 0.07. (a) State the null and alternative hypotheses for this test (using appropriate notation for proportions). (b) Should they reject the null hypothesis? (c) If they mistakenly reject the null, what type of error would that be? (d) If they fail to reject the null but the new button actually does increase purchases, what type of error have they made?
Graded on Correct formulation of H₀ and H₁ · Correct decision based on p-value vs α · Accurate identification of Type I and II errors
A data scientist runs an A/B test with α = 0.01 and obtains a p-value of 0.003. They claim 'this result is highly statistically significant, so the new feature definitely causes a large improvement.' Evaluate this claim. What can you conclude from the p-value alone? What additional information would you need to judge practical importance?
Graded on Correct interpretation of statistical significance · Identification of missing information · Acknowledgment of limitations and assumptions
A product manager runs an A/B test on a new landing page. The p-value is 0.15, so they conclude 'the new page is no better than the old one — we can roll it out to everyone safely.' Write a short essay (200-400 words) explaining why this conclusion is problematic. Specifically: (1) What does 'fail to reject H₀' actually mean? (2) Why can't a non-significant result prove that the null hypothesis is true? (3) What other factors and statistics should be considered before making a business decision?
Graded on Correct interpretation of failing to reject H₀ · Reasons why non-significance does not validate H₀ · Additional factors for business decision








