What is a hypothesis test?
A way to check a claim about a population (a mean, a proportion) using a sample. We assume the claim is true and ask: would data like ours be surprising?
H₀, the null hypothesis: the claim we start from. It always has an equals sign.
HA, the alternative: what we look for evidence of.
H₀: μ = μ₀
How far is the sample mean from μ₀, in standard errors? If H₀ is true it follows a t-distribution with n − 1 degrees of freedom.
t = (ȳ − μ₀) / (s/√n)
The p-value is the probability, if H₀ were true, of a test statistic at least as extreme as the one observed. Small p means strong evidence against H₀.
p ≤ α ⇒ reject H₀
Which alternative? It depends on the question
Two ways to be wrong
| H₀ is true | H₀ is false | |
|---|---|---|
| Reject H₀ | Type I error (probability α) | Correct |
| Do not reject H₀ | Correct | Type II error |
Drug trial: a Type I error approves a drug that does not work; a Type II error misses one that does.
A worked example: the sugar claim
Tutorial 5, Q5. A soft-drink producer says its cans average 11 g of sugar per 100 mL, and you measured 12 cans. Do they give enough evidence to say the producer’s claim is false?
The five steps, live
Change the alternative hypothesis, the significance level or the sample mean. The red area is the rejection region (probability α); the green area is the p-value. Reject H₀ when t lands in the red, which is exactly when the green area is no bigger than α.
n = 12 and s = 0.4053 stay fixed, so the test uses a t-distribution with 11 degrees of freedom.
Distribution of T = (Ȳ − 11)/(s/√12) if the producer is right: t with 11 df
Why is your t so unusual?
The p-value is not magic. Imagine the producer is right (μ = 11), buy 12 cans again and again, and compute t each time. Count how often t is at least as extreme as yours.
Quick quiz
Six questions. Pick an answer to see whether it is right and why.