Courses › Statistics and Econometrics
Hypothesis testing
Null and alternative hypotheses, t-tests, p-values, Type I and II errors, power, comparing two groups, and the trouble with multiple testing.
A café claims its average wait is 4 minutes; your sample says 4.6. Is the café wrong, or did you just catch a few slow afternoons? A website redesign raised sales from 10.0% to 11.5% of visitors in a test. Real improvement or luck? Hypothesis testing is the formal way to answer “could this be chance?”
This module covers the logic of a test, test statistics and p-values, the two kinds of error and the power of a test, tests comparing two groups (including the A/B tests companies run every day), and the ways testing goes wrong in practice: confusing statistical with practical significance, running too many tests, and publishing only the results that “worked”.
By the end of this module you will be able to
- Set up null and alternative hypotheses and choose between one-sided and two-sided tests.
- Compute a t-statistic and p-value and make a decision at a chosen significance level.
- Explain Type I and Type II errors and what determines a test’s power.
- Test for a difference between two means or two proportions, including in an A/B test.
- Distinguish statistical from practical significance and explain the problems of multiple testing and publication bias.
What this module covers
- The logic of a test
- p-values and significance levels
- Errors and power
- Comparing two groups
- Significance, importance and the multiple-testing problem
- Problem set with step-by-step solutions
- Module quiz
Lesson 5.1 Free lesson
The logic of a test
A hypothesis test starts from a specific claim, the null hypothesis H₀, usually “nothing is going on”: the average wait is 4 minutes, the new design has no effect, the two groups have the same mean. The alternative hypothesis H₁ is what you would believe instead if the data clearly contradict H₀.
The logic resembles a criminal trial. The defendant is presumed innocent (H₀) unless the evidence is strong enough to convict beyond reasonable doubt. A “not guilty” verdict doesn’t declare the defendant innocent; it says the evidence wasn’t strong enough. In the same way, a test either rejects H₀ or fails to reject it. It never “accepts” H₀.
The test statistic
To measure how far the data are from H₀, compute how many standard errors the estimate lies from the value H₀ claims:
If H₀ is true, the CLT says t is approximately standard normal in large samples (and exactly Student’s t for small normal samples). Values far from zero are hard to explain by chance.
Worked example: Is the wait longer than advertised?
A café advertises an average wait of 4 minutes. You time 64 randomly chosen customers: the average is 4.6 minutes, with SD 2.4.
H₀: μ = 4. H₁: μ ≠ 4.
SE = 2.4/√64 = 0.3. t = (4.6 − 4)/0.3 = 2.0.
The sample average is 2 standard errors above the advertised wait. If the true average were 4 minutes, a gap this large would happen in fewer than 5% of samples. Lesson 2 makes that precise.
One-sided or two-sided?
A two-sided alternative (μ ≠ 4) counts surprises in either direction. A one-sided alternative (μ > 4) counts only one direction. Use one-sided only when the other direction is truly irrelevant to the question and you decided before seeing the data. In economics, two-sided tests are the default: a policy could help or hurt, and you want to know either way.
Common mistake
Choosing a one-sided test after looking at the data because it makes the result significant. That halves the p-value by sleight of hand. Decide the direction from the question, before the data.
Key ideas
- H₀ is the specific claim being tested; H₁ is what you would believe instead.
- A test rejects or fails to reject H₀; failing to reject is not proof that H₀ is true.
- The t-statistic counts how many standard errors the estimate is from the null value.
- Two-sided tests are the default; one-sided tests must be justified before seeing the data.
Practice questions: Hypothesis testing
Try these, then open each answer to check your work.
- 1.A test fails to reject H₀ at the 5% level. The correct conclusion is:
- H₀ is true
- H₀ is false
- The data are not strong enough evidence against H₀
- The effect is zero with 95% probability
Show answer
Answer: C. Failing to reject is like a “not guilty” verdict: the evidence wasn’t strong enough, which is not proof of innocence.
- 2.An estimate is 12 with a standard error of 5. For H₀: β = 0, the t-statistic is:
- 0.42
- 2.4
- 5
- 7
Show answer
Answer: B. t = (12 − 0)/5 = 2.4.
- 3.With t = 2.4, the two-sided p-value is about:
- 0.0082
- 0.016
- 0.05
- 0.24
Show answer
Answer: B. 2 × (1 − Φ(2.4)) = 2 × 0.0082 = 0.0164.
Problems with step-by-step solutions
- 4.A bakery claims its loaves weigh 500 grams on average. An inspector weighs 49 loaves: mean 494 g, SD 14 g. Test the claim at the 5% level (two-sided).
Show step-by-step solution
- H₀: μ = 500. SE = 14/√49 = 2.
- t = (494 − 500)/2 = −3.
- |t| = 3 > 1.96, so reject H₀. The p-value is 2 × (1 − Φ(3)) = 0.0027. The loaves appear to be underweight on average.
- 5.For Problem 1, would you reject at the 1% level? What is the 99% confidence interval?
Show step-by-step solution
- |t| = 3 > 2.576, so yes, reject at 1% too.
- 99% interval: 494 ± 2.576 × 2 = 494 ± 5.15, or 488.85 to 499.15 grams, which excludes 500.
Get the full module
The complete module adds every lesson, interactive graphs, a full problem set with step-by-step solutions, and a quiz. The academy opens in January 2027: join the waitlist for the founding price (lifetime access for $179).
Join the waitlist Try a full module free
More practice: free practice questions for this course.