A-Level & Admissions

A-Level & first-year statistics ·

Hypothesis testing
on the mean

Free study notes from A-Level & introductory statistics.

A hypothesis test asks a simple question: is a claim about a whole population believable, given a single sample of data? This page builds the idea from scratch using one running example, then names each piece of the machinery you meet in exams, the null and alternative hypotheses, the sampling distribution of the mean, p-values, the significance level, the critical value and the standardised z-test. No prior stats beyond the normal distribution is assumed.

The question a test answers

Suppose two students argue about the average exam grade of all economics undergraduates in the country.

  • Student A claims the population average grade is no more than 65%.
  • Student B disagrees, believing the true average is higher than 65%.

Nobody can mark every student in the country, so we cannot simply look up the answer. Instead we take a sample, say 25 students chosen at random, and use the sample to judge which claim the evidence supports. The whole subject of hypothesis testing is a disciplined way of doing exactly this.

Step 1, Write the claims as hypotheses

We first turn the two claims into formal statements about the unknown population mean \(\mu\).

Null and alternative hypotheses

The null hypothesis \(H_0\) is the "nothing new here" claim we assume true unless the data forces us to abandon it. The alternative hypothesis \(H_1\) is what we suspect instead.

$$H_0:\ \mu \le 65 \qquad\qquad H_1:\ \mu \gt 65.$$

Intuition

Think of \(H_0\) as the defendant in a courtroom: presumed innocent. We do not try to prove \(H_0\) true; we only ask whether the evidence is strong enough to reject it "beyond reasonable doubt". If it is not, we stick with \(H_0\), not because we have proven it, but because we have no good reason to overturn it.

Step 2, The sample mean is itself random

Here is the idea that makes everything work. If we drew a different random sample of 25 students, we would get a slightly different sample average. So the sample mean \(\bar{X}\) is not a fixed number, it is a random variable with its own distribution, called the sampling distribution of the mean.

Suppose individual grades are normally distributed with mean \(\mu\) and variance \(\sigma^2 = 100\) (so a standard deviation of 10 marks). A standard result then tells us how the average of \(n\) of them behaves:

Sampling distribution of the mean

$$\bar{X}\sim N\!\left(\mu,\ \frac{\sigma^2}{n}\right).$$

With \(\sigma^2=100\) and \(n=25\), the variance of the sample mean is \(\tfrac{100}{25}=4\), so its standard deviation (the standard error) is \(\sqrt{4}=2\).

Intuition

Averaging cancels out flukes. One student can score wildly high or low, but 25 of them averaged together rarely stray far from the truth, which is why the sample mean has a smaller spread (standard error 2) than a single grade (standard deviation 10). Bigger samples squeeze this bell curve narrower still, because the standard error \(\sigma/\sqrt{n}\) shrinks as \(n\) grows.

What students say

“Dr Grant's mock interviews were incredibly realistic and helped me develop the confidence and analytical thinking needed for Cambridge. His personal statement guidance was equally valuable. His mentorship made a huge difference throughout my application, and I am delighted to have received my Cambridge offer.”
XinqiOffer Holder, Economics, University of Cambridge
“Dr Grant's guidance throughout my LSE application was exceptional. His interview coaching and personal statement feedback strengthened both my confidence and my academic approach. I highly recommend him to any student applying for competitive Economics programmes.”
YiyingOffer Holder, Economics, London School of Economics and Political Science
“Every mock interview with Dr Grant challenged me to think more deeply and communicate my ideas clearly. His feedback was insightful, encouraging and practical. I felt thoroughly prepared for my Cambridge interview and was thrilled to receive an offer.”
Offer HolderEconomics, University of Cambridge
“Dr Grant helped me develop genuine economic reasoning rather than memorising answers. His realistic interview preparation and thoughtful advice gave me the confidence to perform at my best and secure my Cambridge offer.”
Offer HolderEconomics, University of Cambridge
“Dr Grant is an outstanding mentor whose interview preparation closely reflected the real Cambridge experience. His support with both my personal statement and interview performance played a significant role in my successful application.”
Offer HolderEconomics, University of Cambridge

Step 3, How surprising is our sample?

Now suppose our 25-student sample has an average of 67%. That is above 65, but is it convincingly above 65, or just the kind of wobble we would expect by chance even if Student A were right?

To judge this we ask: if the null hypothesis were true (take the boundary case \(\mu = 65\)), how likely is a sample mean at least as large as the one we saw? Under \(H_0\), \(\bar{X}\sim N(65,\,4)\), and the calculation gives

$$\Pr(\bar{X}\ge 67 \mid \mu = 65) = 0.159,\qquad \Pr(\bar{X}\ge 70 \mid \mu = 65) = 0.0062.$$

These probabilities have a name.

Definition, p-value

The p-value is the probability, computed assuming \(H_0\) is true, of observing a result at least as extreme as the one actually obtained. A small p-value means the data would be surprising under \(H_0\), which is evidence against it.

Intuition

A sample mean of 67 could easily happen by chance if the true average were 65 (it happens about 16% of the time), so it is weak evidence. A sample mean of 70 would be a genuine shock under \(H_0\) (about 0.6%), so it is strong evidence that the true average really is above 65. The p-value simply measures that "shock".

Step 4, Fix how much surprise counts: the significance level

We need a threshold: how small must the p-value be before we reject \(H_0\)? That threshold is chosen in advance and is called the significance level, written \(\alpha\). The conventional choice is \(\alpha = 5\%\) (other common choices are 10% and 1%).

Significance level and Type I error

The significance level \(\alpha\) is the probability we are willing to accept of rejecting \(H_0\) when it is actually true. This mistake, a false alarm, is called a Type I error. Setting \(\alpha = 0.05\) means: "I will tolerate at most a 5% chance of wrongly rejecting a true null."

There are two ways a test can go wrong, and it is worth seeing them side by side.

 \(H_0\) is really true\(H_0\) is really false
We reject \(H_0\)Type I error, false alarm (probability \(\alpha\))Correct decision
We keep \(H_0\)Correct decisionType II error, missed detection
Intuition

A Type I error is convicting an innocent defendant; a Type II error is letting a guilty one walk free. Lowering \(\alpha\) (say to 1%) makes false alarms rarer but makes the test harder to trigger, so real effects are missed more often. You cannot drive both errors to zero at once, you choose the trade-off before seeing the data.

Step 5, Turn the level into a decision rule: the critical value

Rather than compute a p-value every time, we can work out, once and for all, the cut-off sample mean beyond which we would reject. This cut-off is the critical value \(c\). We choose \(c\) so that the chance of landing above it, when \(H_0\) is true, is exactly \(\alpha = 5\%\):

$$\Pr(\bar{X} \gt c \mid \mu = 65) = 0.05.$$

For a normal distribution, 5% of the area sits above 1.645 standard deviations past the mean. Our standard error is 2, so

$$c = 65 + 1.645\times 2 = 68.29.$$

Decision rule

Reject \(H_0\) if the sample mean exceeds \(68.29\); otherwise do not reject \(H_0\). The shaded region beyond \(68.29\) below is the rejection region, and it contains exactly 5% of the probability.

59616365676971 c = 68.29 μ = 65 (H₀ true) reject H₀ (area = 5%) sample mean grade (%)

The sampling distribution of the mean under \(H_0\!:\mu=65\). Any sample mean falling in the shaded 5% tail leads us to reject the null in favour of \(H_1\).

Step 6, The tidy version: the standardised z-test

Working with a critical value of 68.29 is fine, but it depends on the particular numbers 65 and 2. In practice we standardise so that every test uses the same cut-off. Subtract the mean and divide by the standard error:

The z-statistic

$$z = \frac{\bar{X}-\mu_0}{\sigma/\sqrt{n}},$$

where \(\mu_0\) is the value of the mean under \(H_0\). When \(H_0\) is true, \(z\) follows the standard normal distribution, \(N(0,1)\). We reject \(H_0\) at the 5% level (one-sided) when \(z \gt 1.645\).

The two rules are identical: saying "\(\bar{X}\gt 68.29\)" is the same as saying "\(\dfrac{\bar{X}-65}{2}\gt 1.645\)". Standardising just re-expresses the same picture on a fixed axis, so you only ever need one number, 1.645, from a table (or 1.96 for a two-sided test at 5%).

Worked example

Worked example

Our random sample of \(n=25\) students has mean grade \(\bar{X}=67\), with population standard deviation \(\sigma=10\). Test \(H_0:\mu\le 65\) against \(H_1:\mu\gt 65\) at the 5% level.

Standard error: \(\sigma/\sqrt{n} = 10/\sqrt{25} = 2.\)

Test statistic: \(z = \dfrac{67-65}{2} = 1.00.\)

Compare: \(1.00 \lt 1.645\), so the statistic does not fall in the rejection region.

Conclusion: we do not reject \(H_0\). A sample mean of 67 is consistent with a true average of 65, there is not enough evidence to support Student B. (Equivalently, the p-value is \(0.159 \gt 0.05\).)

Now suppose instead the sample mean had been \(\bar{X}=70\). Then \(z = \dfrac{70-65}{2} = 2.5 \gt 1.645\): we reject \(H_0\) and conclude the evidence supports Student B. The p-value here is \(0.0062\), far below 5%.

Watch out

"Do not reject \(H_0\)" is not the same as "\(H_0\) is true". It only means the evidence was too weak to overturn it, exactly like a "not guilty" verdict does not prove innocence. And always decide whether your test is one-tailed (as here, \(H_1:\mu\gt 65\)) or two-tailed (\(H_1:\mu\ne 65\)); the two-tailed test splits the 5% across both tails and uses the larger critical value 1.96.

The recipe, in five lines

  1. State \(H_0\) and \(H_1\) about the population mean \(\mu\), and pick a significance level \(\alpha\) (usually 5%).
  2. Collect the sample and compute the sample mean \(\bar{X}\).
  3. Standardise: \(z = (\bar{X}-\mu_0)\big/(\sigma/\sqrt{n})\).
  4. Compare \(z\) with the critical value from normal tables (1.645 one-sided, 1.96 two-sided at 5%).
  5. If \(z\) is beyond the critical value, reject \(H_0\); otherwise do not reject. State the conclusion in words.

Check your understanding

A sample of \(n=16\) has mean \(\bar{X}=53\); the population has mean 50 under \(H_0\) and standard deviation 8. Test \(H_0:\mu\le 50\) vs \(H_1:\mu\gt 50\) at 5%.

Standard error \(=8/\sqrt{16}=2\). Then \(z=(53-50)/2=1.5\). Since \(1.5\lt 1.645\), we do not reject \(H_0\): the sample is consistent with a mean of 50 at the 5% level.

Why does a larger sample make it easier to detect that \(\mu\gt 65\)?

The standard error is \(\sigma/\sqrt{n}\), which shrinks as \(n\) grows. A narrower sampling distribution means the same true difference (say the real mean is 67) produces a larger z-statistic, so it is more likely to clear the critical value. Bigger samples reduce the chance of a Type II error.

If you lowered the significance level from 5% to 1%, would the critical value move in or out, and what happens to the two error types?

At 1% the one-sided critical value rises from 1.645 to about 2.33, so the rejection region moves further out into the tail. Type I errors (false alarms) become rarer, but because the test is now harder to trigger, Type II errors (missed real effects) become more common.

Related notes

Stuck on a
statistics topic?

I tutor statistics and maths from A-Level through university, hypothesis testing, probability and the rest of the syllabus, with worked examples at your pace. The first consultation is free.

Book a consultation How sessions work & pricing
Free 30-min consultationNo obligation · reply within one business day
Book now