Skip to Main Content
Think Stats, 2nd Edition
book

Think Stats, 2nd Edition

by Allen B. Downey
October 2014
Beginner content levelBeginner
226 pages
5h 42m
English
O'Reilly Media, Inc.
Content preview from Think Stats, 2nd Edition

Chapter 9. Hypothesis Testing

The code for this chapter is in hypothesis.py. For information about downloading and working with this code, see Using the Code.

Classical Hypothesis Testing

Exploring the data from the NSFG, we saw several “apparent effects,” including differences between first babies and others. So far we have taken these effects at face value; in this chapter, we put them to the test.

The fundamental question we want to address is whether the effects we see in a sample are likely to appear in the larger population. For example, in the NSFG sample we see a difference in mean pregnancy length for first babies and others. We would like to know if that effect reflects a real difference for women in the U.S., or if it might appear in the sample by chance.

There are several ways we could formulate this question, including Fisher null hypothesis testing, Neyman-Pearson decision theory, and Bayesian inference.[4] What I present here is a subset of all three that makes up most of what people use in practice, which I will call classical hypothesis testing.

The goal of classical hypothesis testing is to answer the question, “Given a sample and an apparent effect, what is the probability of seeing such an effect by chance?” Here’s how we answer that question:

  • The first step is to quantify the size of the apparent effect by choosing a test statistic. In the NSFG example, the apparent effect is a difference in pregnancy length between first babies and others, so a natural choice for ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Think Bayes, 2nd Edition

Think Bayes, 2nd Edition

Allen B. Downey
Practical Tableau

Practical Tableau

Ryan Sleeper

Publisher Resources

ISBN: 9781491907344Errata