Statistics & Probability · Grades 11, 12
Hypothesis Testing: Null Hypotheses, z-Tests and P-Values
Quick answer
A hypothesis test asks whether data are surprising if a claim is true. The null hypothesis states the claim, such as p = 0.5; the alternative states what we suspect instead. The test statistic z = (estimate − claimed value)/standard error measures how far the data fall from the claim. The p-value is the probability of a result at least that extreme when the null is true. A small p-value, below the significance level α, is evidence against the null.
What you'll learn
- State null and alternative hypotheses
- Compute a z test statistic for a proportion or a mean
- Find and interpret a one-sided or two-sided p-value
- Describe Type I and Type II errors
Is the data surprising if the claim is true?
A coin lands heads times in tosses. Is it unfair, or is within ordinary luck for a fair coin? A hypothesis test turns that question into arithmetic.
-
Hypotheses. The null hypothesis is the claim to be tested: the coin is fair, . The alternative is what we suspect instead: .
-
Test statistic. Measure how far the data fall from the claim, in standard errors, assuming is true:
-
P-value. The probability of a result at least this far out, in either direction, if is true: .
-
Decision. At the usual significance level , the p-value is smaller, so we reject : the data are evidence the coin is not fair.
- standard normal curve
Why we argue from the null hypothesis
We cannot compute probabilities under “the coin is unfair”, because that does not say how unfair. The null hypothesis is specific, so it fixes a sampling distribution: under , is approximately normal with mean and standard error . Against that yardstick we can say exactly how rare the data are.
The logic is like a proof by contradiction, with probability in place of certainty. If the claim leads us to expect results like ours only rarely, the claim is in doubt. A large p-value does not prove ; it only says the data are consistent with it. So we “fail to reject” rather than “accept”.
One side or two
Choose the alternative before looking at the data.
- Two-sided, : count both tails, as with the coin.
- One-sided, or : count only the tail in the suspected direction.
For the coin, a one-sided test of would give .
Worked examples
Two ways to be wrong
| is true | is false | |
|---|---|---|
| reject | Type I error | correct |
| fail to reject | correct | Type II error |
The probability of a Type I error is itself: a true null is rejected whenever chance alone produces a p-value below . Lowering makes Type I errors rarer but Type II errors more common. A larger sample reduces Type II errors without raising .
Common mistakes
Practice problems
-
A coin lands heads times in . Test against at .
Answer
, p-value ; fail to reject.
Full solution
. The two-sided p-value is , above .
-
A store claims of customers use its app. In a sample of , do. Test at .
Answer
, p-value ; reject .
Full solution
. The standard error is , so and the one-sided p-value is about .
-
A process should average with . A sample of averages . Test at .
Answer
, p-value ; reject .
Full solution
The standard error is , so , and .
-
For the coin in the lesson, what is the p-value of the one-sided test ?
Answer
Full solution
Only the upper tail counts: .
-
A drug trial rejects (no effect) when the drug in fact has no effect. Which error is this?
Answer
A Type I error
Full solution
A true null hypothesis was rejected.
-
A test at gives a p-value of . What is the decision, and what does it mean?
Answer
Fail to reject ; the evidence against it is not strong enough at this level.
Full solution
Since , results like these would be fairly common if were true. That does not prove .
-
How does lowering from to affect the two error types?
Answer
Type I errors become rarer; Type II errors become more common.
Full solution
A smaller demands stronger evidence before rejecting, so true nulls are rejected less often, and false nulls are missed more often.
-
A student says, “The p-value is , so there is a chance the coin is fair.” Correct the statement.
Answer
If the coin were fair, there would be a chance of a result at least this far from heads.
Full solution
The p-value is computed assuming . It measures how surprising the data are under the claim, not how likely the claim is.
Frequently asked questions
What is a null hypothesis?
The claim being tested, usually a statement of no effect or no difference, such as p = 0.5 for a fair coin. The test looks for evidence against it.
What is a p-value?
The probability, assuming the null hypothesis is true, of getting a result at least as extreme as the one observed. A small p-value means the data would be surprising if the null were true.
How do you decide whether to reject the null hypothesis?
Compare the p-value with the significance level α, often 0.05. If p < α, reject the null; otherwise, fail to reject it.
What is the difference between one-sided and two-sided tests?
A one-sided test looks for a difference in one direction only, such as p > 0.3. A two-sided test looks in both directions, so its p-value counts both tails.
What are Type I and Type II errors?
A Type I error rejects a true null hypothesis; its probability is α. A Type II error fails to reject a false null hypothesis.
Standards alignment
This lesson covers the following Common Core State Standards for Mathematics.
- CCSS.MATH.CONTENT.HSS.IC.A.2Making Inferences and Justifying ConclusionsDecide if a specified model is consistent with results from a given data-generating process, e.g., using simulation.
- CCSS.MATH.CONTENT.HSS.IC.B.5Making Inferences and Justifying ConclusionsUse data from a randomized experiment to compare two treatments; use simulations to decide if differences between parameters are significant.