2.05StatisticsStretch

Hypothesis Testing

A company claims 25% of its customers win a prize. In a sample of 20, nine win. Is the claim wrong, or was the sample just lucky? Hypothesis testing\textbf{Hypothesis testing} gives a principled way to decide: assume the claim is true, work out how surprising the evidence would be, and reject the claim only if the evidence is surprising enough.

50 min Probability

The big picture

A hypothesis test is an argument by contradiction with a probability threshold. The null hypothesis H0\mathrm{H}_{0} fixes a parameter at its claimed value; the alternative H1\mathrm{H}_{1} says how you suspect it differs. You then calculate the probability of a result at least as extreme as the one observed, assuming H0\mathrm{H}_{0}. If that probability falls below the significance level, the result is too unlikely to blame on chance, and H0\mathrm{H}_{0} is rejected. OCR tests this with the binomial distribution in Year 1, and with the normal distribution for a sample mean in Year 2. The mathematics is short; what earns the marks is precise language — hypotheses in terms of the parameter, a comparison with the significance level, and a conclusion in context that never claims certainty.

What you'll be able to do

  • Write null and alternative hypotheses in terms of a population parameter
  • Carry out one-tailed and two-tailed binomial tests using probabilities or critical regions
  • Find critical regions and actual significance levels
  • Test a population mean using the normal distribution of a sample mean
  • Write conclusions in context with appropriately non-definite language
1

The language of hypothesis tests

The null hypothesis\textbf{null hypothesis} H0\mathrm{H}_{0} states the parameter takes the claimed value, e.g. H0:p=0.25\mathrm{H}_{0}: p = 0.25. The alternative hypothesis\textbf{alternative hypothesis} H1\mathrm{H}_{1} states how it might differ: p>0.25p > 0.25 or p<0.25p < 0.25 (one-tailed), or p≠0.25p \neq 0.25 (two-tailed).

The test statistic\textbf{test statistic} is the observed value, such as the number of successes XX. The significance level\textbf{significance level}, often 5%, is the probability threshold below which a result is considered too unlikely under H0\mathrm{H}_{0}.

The critical region\textbf{critical region} is the set of values of the test statistic that would lead to rejecting H0\mathrm{H}_{0}; its boundary is the critical value\textbf{critical value}.

Tip — Hypotheses are always about the population parameter (pp or μ\mu), never about the sample result. Writing "H0:X=9\mathrm{H}_{0}: X = 9" earns nothing.

2

A one-tailed binomial test

Under H0\mathrm{H}_{0}, X∼B(n,p0)X \sim \mathrm{B}(n, p_{0}). For H1:p>p0\mathrm{H}_{1}: p > p_{0}, calculate P(X≥xobs)\mathrm{P}(X \ge x_{\text{obs}}); for H1:p<p0\mathrm{H}_{1}: p < p_{0}, calculate P(X≤xobs)\mathrm{P}(X \le x_{\text{obs}}).

If this probability is less than the significance level, reject H0\mathrm{H}_{0}. Otherwise, do not reject it.

Example 1A company claims 25% of customers win a prize. A journalist suspects the true figure is higher. In a random sample of 20, nine win. Test at the 5% level.
1H0:p=0.25\mathrm{H}_{0}: p = 0.25, H1:p>0.25\mathrm{H}_{1}: p > 0.25, where pp is the proportion of all customers who win.
2Under H0\mathrm{H}_{0}, X∼B(20,0.25)X \sim \mathrm{B}(20, 0.25).
3P(X≥9)=1−P(X≤8)=0.0409\mathrm{P}(X \ge 9) = 1 - \mathrm{P}(X \le 8) = 0.0409.
40.0409<0.050.0409 < 0.05, so the result is significant: reject H0\mathrm{H}_{0}.
AnswerThere is sufficient evidence at the 5% level to suggest that more than 25% of customers win a prize.
Why this works

The probability is of "9 or more\textit{or more}", not "exactly 9". Any single value is fairly unlikely in a spread-out distribution; the question is whether the observed result lies in the extreme tail.

3

Critical regions and two-tailed tests

To find a critical region for H1:p>p0\mathrm{H}_{1}: p > p_{0}, find the smallest cc such that P(X≥c)≤\mathrm{P}(X \ge c) \le the significance level. The actual significance level\textbf{actual significance level} is P(X≥c)\mathrm{P}(X \ge c), usually a little below the nominal level because the binomial is discrete.

For a two-tailed test at 5%, split the significance level: find a critical region in each tail with probability at most 2.5%.

Example 1Find the critical region for testing H0:p=0.4\mathrm{H}_{0}: p = 0.4 against H1:p≠0.4\mathrm{H}_{1}: p \neq 0.4 with n=25n = 25 at the 5% level, and the actual significance level.
1Lower tail: P(X≤5)=0.0294>0.025\mathrm{P}(X \le 5) = 0.0294 > 0.025 but P(X≤4)=0.0095≤0.025\mathrm{P}(X \le 4) = 0.0095 \le 0.025, so X≤4X \le 4.
2Upper tail: P(X≥15)=0.0344>0.025\mathrm{P}(X \ge 15) = 0.0344 > 0.025 but P(X≥16)=0.0132≤0.025\mathrm{P}(X \ge 16) = 0.0132 \le 0.025, so X≥16X \ge 16.
3Actual significance level =0.0095+0.0132= 0.0095 + 0.0132.
AnswerCritical region X≤4X \le 4 or X≥16X \ge 16; actual significance level 2.27%2.27\%.

Tip — Show the two probabilities either side of each boundary — one just above and one just below the tail threshold. That is what justifies the critical value.

4

Testing a mean with the normal distribution

If X∼N(μ,σ2)X \sim \mathrm{N}(\mu, \sigma^{2}), the mean of a random sample of size nn satisfies Xˉ∼N(μ,σ2n)\bar{X} \sim \mathrm{N}\left(\mu, \dfrac{\sigma^{2}}{n}\right). Larger samples give sample means that cluster more tightly around μ\mu.

To test H0:μ=μ0\mathrm{H}_{0}: \mu = \mu_{0}, calculate P(Xˉ≥xˉ)\mathrm{P}(\bar{X} \ge \bar{x}) (or ≤\le), or compare z=xˉ−μ0σ/nz = \dfrac{\bar{x} - \mu_{0}}{\sigma/\sqrt{n}} with the critical zz-value.

Xˉ∼N(μ,σ2n),z=xˉ−μ0σ/n\bar{X} \sim \mathrm{N}\left(\mu, \dfrac{\sigma^{2}}{n}\right), \qquad z = \dfrac{\bar{x} - \mu_{0}}{\sigma / \sqrt{n}}
Distribution of the sample mean.
Example 1Battery lifetimes are N(μ,62)\mathrm{N}(\mu, 6^{2}) hours. The maker claims μ=50\mu = 50. A sample of 16 has mean 52.7 hours. Test at the 5% level whether the mean is greater than 50.
1H0:μ=50\mathrm{H}_{0}: \mu = 50, H1:μ>50\mathrm{H}_{1}: \mu > 50.
2Under H0\mathrm{H}_{0}, Xˉ∼N(50,3616)\bar{X} \sim \mathrm{N}\left(50, \tfrac{36}{16}\right), standard deviation 1.51.5.
3z=52.7−501.5=1.8>1.645z = \dfrac{52.7 - 50}{1.5} = 1.8 > 1.645; equivalently P(Xˉ≥52.7)=0.0359<0.05\mathrm{P}(\bar{X} \ge 52.7) = 0.0359 < 0.05.
AnswerReject H0\mathrm{H}_{0}: there is sufficient evidence at the 5% level that the mean battery life exceeds 50 hours.

Think like an examiner

  • Define the parameter in words and write hypotheses using it.
  • State the distribution under H0\mathrm{H}_{0}.
  • Compare the probability or test statistic with the significance level explicitly.
  • Conclude in context with non-definite language: "there is sufficient evidence to suggest...".

Common misconceptions

Calculating P(X=9)\mathrm{P}(X = 9) instead of P(X≥9)\mathrm{P}(X \ge 9).
Use the probability of the observed value or more extreme.
Concluding "the claim is proven false".
Tests give evidence, not proof: "sufficient evidence to suggest...".
Using the full 5% in each tail of a two-tailed test.
Split it: 2.5% in each tail.
Using σ\sigma instead of σn\dfrac{\sigma}{\sqrt{n}} for a sample mean.
The sample mean has standard deviation σ/n\sigma/\sqrt{n}.

Hypothesis testing

H0:p=p0\mathrm{H}_{0}: p = p_{0}
Null hypothesis.
P(X≥xobs)<α⇒reject H0\mathrm{P}(X \ge x_{\text{obs}}) < \alpha \Rightarrow \text{reject } \mathrm{H}_{0}
Upper-tail decision.
Xˉ∼N(μ,σ2/n)\bar{X} \sim \mathrm{N}(\mu, \sigma^{2}/n)
Sample mean.

Stretch yourself

A coin is suspected of being biased towards tails. It is tossed 15 times. Using a 5% significance level, find the critical region for a test of H0:p=0.5\mathrm{H}_{0}: p = 0.5 against H1:p<0.5\mathrm{H}_{1}: p < 0.5, where pp is the probability of heads, and state the actual significance level. Then explain what a result of 4 heads would mean.

Hint — Under H0\mathrm{H}_{0}, X∼B(15,0.5)X \sim \mathrm{B}(15, 0.5). Find the largest cc with P(X≤c)≤0.05\mathrm{P}(X \le c) \le 0.05.

Reveal solution
SolutionUnder H0\mathrm{H}_{0}, X∼B(15,0.5)X \sim \mathrm{B}(15, 0.5). P(X≤3)=0.0176\mathrm{P}(X \le 3) = 0.0176 and P(X≤4)=0.0592\mathrm{P}(X \le 4) = 0.0592. Since 0.0176≤0.05<0.05920.0176 \le 0.05 < 0.0592, the critical region is X≤3X \le 3, with actual significance level 1.76%1.76\%. A result of 4 heads is not in the critical region, so we do not reject H0\mathrm{H}_{0}: there is insufficient evidence at the 5% level to suggest the coin is biased towards tails. This does not show the coin is fair — only that 15 tosses were not enough to detect bias of this size. ■\blacksquare

Questions students ask

What is the difference between one-tailed and two-tailed tests?
One-tailed tests look for a change in a specified direction; two-tailed tests look for any change, so the significance level is split between both tails.
Why can’t I accept the null hypothesis?
Failing to find evidence against a claim is not evidence for it. You say there is insufficient evidence to reject H0\mathrm{H}_{0}.
Why is the actual significance level smaller than 5%?
The binomial distribution is discrete, so tail probabilities jump in steps and rarely equal exactly 5%.
Where does the direction of H1\mathrm{H}_{1} come from?
From the question’s wording — "suspects it has increased" gives >>, "believes it has changed" gives ≠\neq. Decide it before looking at the data.

Key takeaways

  • Hypotheses are statements about a population parameter.
  • Assume H0\mathrm{H}_{0}, find the probability of a result at least as extreme as observed, and compare with the significance level.
  • Critical regions: the most extreme values with total probability at most the significance level (split for two tails).
  • For means, use Xˉ∼N(μ,σ2/n)\bar{X} \sim \mathrm{N}(\mu, \sigma^{2}/n).
  • Conclude in context, without claiming certainty.

How this fits the course

Test yourself

Answer a few questions, then review anything you missed.

Next step

Keep practising

Start with the quiz above to check the key ideas. You can also choose another topic from the practice library.

Browse practice topics

Related lessons

All 4 lessons

Put the methods into practice: see how A-Level maths duels work. An account is required to play; the overview and sample are public.