Every hypothesis test follows the same five steps. State the null and alternative hypotheses about a population parameter, before seeing the data. Write the…
English narration · English and 中文 subtitles you can switch
15.1
Scope and prerequisites
AQA A-level Mathematics 7357, section O (Statistical hypothesis testing), version 1.3 (first assessment 2018). Original teaching notes.
Prerequisites: the binomial and normal models from section N, and correlation from section L.
These are original teaching examples, not official AQA material.
A factory says that 10% of its parts are faulty. A customer checks 10 parts and finds 3 faulty ones. That is 30%, not 10%. Is the factory wrong, or was the customer just unlucky? A hypothesis test answers this with probability. It asks: if the claim were true, how unusual would this result be? If the result would be very unusual, we have evidence against the claim.
Randomisation underpins fair comparison of two groups in a mean difference test
The words of testing
Term
Meaning
Null hypothesis 原假设$H_0$
the default claim, such as $p=0.1$
Alternative hypothesis 备择假设$H_1$
what we look for evidence of, such as $p>0.1$
Test statistic 检验统计量
the number from the sample that we test, such as the number of faulty parts $X$
Significance level 显著性水平
how unusual a result must be before we reject $H_0$, such as 5%
Critical region 拒绝域
the values of the test statistic that lead us to reject $H_0$
Critical value 临界值
the first value inside the critical region
The words of testing in order
The hypotheses are always about the population parameter ($p$ or $\mu$), never about the sample. And you write them before you look at the data.
The five steps
State $H_0$ and $H_1$, using the parameter.
State the distribution of the test statistic if $H_0$ is true.
Find the probability of a result at least as extreme as the one observed (the p-value p值), or find the critical region.
Compare with the significance level.
Write a conclusion in context, with no certainty.
A binomial test
Worked example. The factory claim: $p=0.1$. The customer finds 3 faulty parts in 10. Test at the 5% level whether the rate is higher.
$$H_0:p=0.1,\qquad H_1:p>0.1.$$
If $H_0$ is true, $X\sim B(10,0.1)$. The result 3 is in the upper tail, so find $P(X\ge3)$:
$$P(X\ge3)=1-P(X\le2)=1-0.9298=0.0702.$$
$0.0702>0.05$, so the result is not in the critical region. Do not reject $H_0$. There is insufficient evidence, at the 5% level, that more than 10% of parts are faulty.
P(X ≥ 3) ≈ 0.0702 > 0.05, so there is insufficient evidence to reject H₀, which does not prove H₀
Common mistake. Finding $P(X=3)=0.0574$. The test needs the whole tail, “3 or more”, because a result of 4 or 5 would be even stronger evidence.
Writing the conclusion. A good conclusion has three parts: the decision, the level, and the context.
Weak
Strong
“$H_0$ is true.”
“Do not reject $H_0$. There is insufficient evidence at the 5% level that the rate of faulty parts is above 10%.”
“Reject $H_0$.”
“Reject $H_0$. There is evidence at the 5% level that the rate of faulty parts is above 10%.”
Never write that a test proves anything. A test only weighs evidence.
One tail or two?
Read $H_1$ from the question's words:
Words in the question
$H_1$
Test
“has increased”, “is higher”
$p>0.3$
one-tailed test 单尾检验, upper tail
“has decreased”, “is lower”
$p<0.3$
one-tailed, lower tail
“has changed”, “is different”
$p\ne0.3$
two-tailed test 双尾检验
In a two-tailed test at the 5% level, put 2.5% in each tail. Then compare each tail probability with 0.025.
Finding a critical region
Worked example: one tail.$X\sim B(20,0.3)$. Test $H_0:p=0.3$ against $H_1:p<0.3$ at the 5% level. Find the critical region.
Look down the cumulative table for the lower tail:
$k$
1
2
3
4
$P(X\le k)$
0.0076
0.0355
0.1071
0.2375
$P(X\le2)=0.0355\le0.05$, but $P(X\le3)=0.1071>0.05$. So the critical region is $X\le2$.
The actual significance level 实际显著性水平 is $P(X\le2)=0.0355$, or 3.55%. It is below 5% because the binomial is discrete: there is no region with a probability of exactly 5%. The actual level is the true probability of rejecting $H_0$ when it is true.
Worked example: two tails. The same $X$, but $H_1:p\ne0.3$ at the 10% level, so 5% in each tail.
Lower tail: $P(X\le2)=0.0355\le0.05$ and $P(X\le3)=0.1071$, so $X\le2$.
Upper tail: $P(X\ge10)=1-P(X\le9)=1-0.9520=0.0480\le0.05$, and $P(X\ge9)=1-0.8867=0.1133$, so $X\ge10$.
The critical region is $X\le2$ or $X\ge10$. The actual significance level is $0.0355+0.0480=0.0835$.
The two-tailed critical region for B(20, 0.3) at the 10% level
Common mistake. For the upper tail, “$X\ge10$” is $1-P(X\le9)$, not $1-P(X\le10)$.
Testing a normal mean
When the population is normal, $X\sim N(\mu,\sigma^2)$ with known $\sigma$, the sample mean of $n$ values has a smaller spread:
A bigger sample gives a narrower distribution, so it can detect smaller changes.
Worked example. Bags of rice have masses $N(50,5^2)$ grams. After a change to the machine, a sample of 25 bags has mean $\bar x=51.8$. Test at the 5% level whether the mean has increased.
$$H_0:\mu=50,\qquad H_1:\mu>50.$$
If $H_0$ is true, $\bar X\sim N\!\left(50,\frac{5^2}{25}\right)=N(50,1^2)$.
Using the p-value: $P(\bar X\ge51.8)=P(Z\ge1.8)=0.0359<0.05$.
Using the critical value: $50+1.6449\times1=51.64$, and $51.8>51.64$.
Both say the same: reject $H_0$. There is evidence at the 5% level that the mean mass has increased.
A binomial critical region rarely holds exactly 5%: here the two tails hold 8.35%; the sample mean 51.8 lies beyond 51.64, so H₀ is rejected
Common mistake. Standardising with $\sigma=5$ instead of $\frac\sigma{\sqrt n}=1$. The test is about the sample mean, so use its own standard deviation.
Testing a correlation
The correlation coefficient 相关系数$r$ of a sample estimates the population value $\rho$. You test whether there is any correlation in the population:
$H_0:\rho=0$ (no correlation);
$H_1:\rho>0$, $\rho<0$ or $\rho\ne0$, from the question's words.
Compare $r$ with the critical value from the table for the sample size $n$.
Worked example. For 20 students, revision time and test mark have $r=0.52$. Test at the 5% level for positive correlation. The table gives 0.3783 for $n=20$, one tail. $0.52>0.3783$, so reject $H_0$. There is evidence at the 5% level of positive correlation between revision time and mark in the population.
What a test can and cannot say
Not rejecting $H_0$ does not prove it. The sample may be too small to show a real change.
At the 5% level, a true $H_0$ is still rejected about 5% of the time (or the actual level, for a binomial test). This is the risk you accept.
“Significant” means unlikely by chance, not “large” or “important”. A tiny change can be significant in a very large sample.
Traps
Slip
Fix
$H_0:\hat p=0.3$ or $H_0:\bar x=50$
use the population parameter: $p$ or $\mu$
testing $P(X=3)$
test the tail: $P(X\ge3)$
a two-tailed test against 5% in one tail
2.5% in each tail
“$H_0$ is proved”
“insufficient evidence to reject $H_0$”
$\sigma$ used for $\bar X$
$\frac\sigma{\sqrt n}$
Practice
Write $H_0$ and $H_1$: a coin is tested to see if it is biased towards heads.
$X\sim B(12,0.35)$, $H_1:p>0.35$, and 8 successes are seen. Test at the 5% level.
$X\sim B(20,0.5)$, $H_1:p\ne0.5$, at the 5% level. Find the critical region and the actual significance level. Use $P(X\le5)=0.0207$ and $P(X\le6)=0.0577$.
Masses are $N(\mu,6^2)$. A sample of 16 has $\bar x=52.3$. Test $H_0:\mu=50$ against $H_1:\mu>50$ at the 5% level.
For 20 cities, $r=-0.41$ between temperature and heating cost. Test for negative correlation at the 5% level (critical value 0.3783).
A test gives a p-value of 0.12. A student writes “so $H_0$ is true”. Correct the statement.
Answers.
$H_0:p=0.5$, $H_1:p>0.5$, where $p$ is the probability of a head.
$P(X\ge8)=1-P(X\le7)=0.0255<0.05$: reject $H_0$; there is evidence that $p>0.35$.
By symmetry, $X\le5$ or $X\ge15$; actual level $2\times0.0207=0.0414$.
$\bar X\sim N(50,1.5^2)$, $z=1.53$, $P(Z\ge1.53)=0.063>0.05$: do not reject $H_0$; insufficient evidence that the mean has increased.
$-0.41<-0.3783$: reject $H_0$; there is evidence of negative correlation.
“There is insufficient evidence to reject $H_0$.” The test cannot show that $H_0$ is true.
Key points
Hypotheses use the population parameter and are written before the data are seen.
Test the whole tail at least as extreme as the result, under $H_0$.
Two-tailed: half the significance level in each tail.
Binomial critical regions: the actual significance level is the true tail probability, often below the nominal level.
For a normal mean, $\bar X\sim N\!\left(\mu,\frac{\sigma^2}n\right)$.
Conclude in context, with no certainty: “evidence” or “insufficient evidence”.
Explore
Hypothesis testing and contextual conclusions
State H₀ and H₁ in population parameters before inspecting the outcome
Compare the model with the worked case and explain one change.