Instant PDF download, name-and-email checkout. Complete bundle: every Economics and Statistics book
Statistics guide, Unit 3, step 13 of 22Previous stepNext step

Step 13: Hypothesis Testing: The Foundations

SyllabusAP Stats 3.5–3.6
In 30 seconds
  • A hypothesis test assumes the null hypothesis \( H_0 \) (“no effect”, always an equals sign) is true. It then asks whether the data would be too surprising if that were so. The alternative \( H_a \) is what you suspect instead.
  • The test statistic = (estimate − hypothesised value) ÷ standard error: \( t \) for a mean (\( df = n – 1 \)), \( z \) for a proportion, with the standard error worked out from \( p_0 \).
  • The p-value is the chance of a result at least as extreme as yours, assuming \( H_0 \) is true. If \( p \le \alpha \), reject \( H_0 \); otherwise “fail to reject”. Never say “accept”.
  • Exam point: a Type I error rejects a true \( H_0 \) (probability \( \alpha \)); a Type II error misses a false one (probability \( \beta \)). Power \( = 1 – \beta \).
Video lesson coming soonA short animated lesson for this step will appear here.

The logic of a test: assume, then look for surprise

A company says its batteries last 500 hours. A consumer group tests 16 of them and gets a mean of 486 hours, with a standard deviation of 20 hours. That is 14 hours short. Is the advert false? Maybe. Or maybe these 16 batteries were just a slightly unlucky sample, since Step 9 showed that sample means always bounce around. We need a fair way to tell these two stories apart.

The method feels backwards at first. You assume the claim you doubt is true, then check whether the data makes that assumption look silly. It works like a criminal trial. The court presumes the defendant is innocent and asks whether the evidence is too strong to fit with innocence. If it is, the court convicts. If not, the defendant is acquitted. But acquittal does not prove innocence; it only means guilt was not shown. Tests behave exactly the same way.

Key termNull hypothesis \( H_0 \): the statement of “no effect”, “no difference” or “the claim holds”; it always contains an equals sign and is assumed true during the test.
Key termAlternative hypothesis \( H_a \): what you suspect is true instead; it is the claim that needs evidence.
Situation\( H_0 \)\( H_a \)Type
Batteries last less than advertised\( \mu = 500 \)\( \mu < 500 \)Left-tailed
A new method raises scores\( \mu = 70 \)\( \mu > 70 \)Right-tailed
The mean differs from target either way\( \mu = 100 \)\( \mu \ne 100 \)Two-tailed
Support differs from half\( p = 0.5 \)\( p \ne 0.5 \)Two-tailed
Common mistakeWriting hypotheses about the sample. Write \( H_0: \mu = 500 \), never \( H_0: \bar{x} = 500 \). You already know \( \bar{x} \) because you measured it; the test is about the unknown population value. Also, pick the alternative from the research question before looking at the data. Choosing a one-tailed test after seeing which way the sample fell is a form of cheating.

The test statistic

Once the hypotheses are set, you measure how far the data is from what \( H_0 \) predicts, in standard-error units. That distance is the test statistic.

\[ \text{test statistic} = \frac{\text{estimate} – \text{hypothesised value}}{\text{standard error}} \]

For a mean when \( \sigma \) is unknown, this gives the one-sample \( t \) statistic with \( df = n – 1 \). For a proportion you use \( z \). Note that its standard error uses the hypothesised \( p_0 \), not \( \hat{p} \), because the whole test runs on the assumption that \( H_0 \) is true. (This is different from the confidence interval in Step 10, which uses \( \hat{p} \).)

\[ t = \frac{\bar{x} – \mu_0}{s / \sqrt{n}} \qquad z = \frac{\hat{p} – p_0}{\sqrt{p_0(1-p_0)/n}} \]

The p-value and the decision

The test statistic says how far out the data landed. The p-value turns that distance into a probability.

Key termp-value: the probability of getting a result at least as extreme as the one observed, assuming \( H_0 \) is true; it is the tail area beyond the test statistic in the direction(s) given by \( H_a \).

Think of it as a measure of surprise. A small p-value means data like yours would be rare if \( H_0 \) were true, which counts as evidence against \( H_0 \). For a two-tailed test, “extreme” means far out in either direction, so the p-value is usually twice the one-tail area.

To make a decision, you pick a significance level \( \alpha \) in advance, most often 0.05, or 0.01 when mistakes are costly.

  • If \( p \le \alpha \): reject \( H_0 \). The result is “statistically significant”.
  • If \( p > \alpha \): fail to reject \( H_0 \).

The words “fail to reject” are chosen with care. Like the acquitted defendant, a null hypothesis that survives has not been proved true. The evidence was just not strong enough. A small study can easily miss an effect that really exists.

Worked example

Test the battery claim at \( \alpha = 0.05 \): \( n = 16 \), \( \bar{x} = 486 \), \( s = 20 \). Battery life is assumed roughly normal, which matters because \( n < 30 \).

Step 1Hypotheses: \( H_0: \mu = 500 \), \( H_a: \mu < 500 \), where \( \mu \) is the true mean life of all batteries
Step 2\( SE = \dfrac{20}{\sqrt{16}} = 5 \), so \( t = \dfrac{486 – 500}{5} = -2.80 \) with \( df = 15 \)
Step 3Left-tail area below \( t = -2.80 \) with 15 df: \( p \approx 0.007 \)
Step 4\( 0.007 < 0.05 \), so reject \( H_0 \)

If the batteries really averaged 500 hours, a sample of 16 this low would happen only about 0.7% of the time. There is convincing evidence that the true mean battery life is less than 500 hours. A two-tailed test would double the p-value to about 0.014.

Do not treat 0.05 as a cliff edge. A machine part should average 100 mm; a sample of 36 gives \( \bar{x} = 104 \), \( s = 12 \), so \( t = 4/2 = 2.00 \) and the two-tailed \( p \approx 0.053 \). You fail to reject at 5%. But 0.053 and 0.048 describe almost the same evidence. Report the actual p-value and let readers judge.

Common mistakeMisreading the p-value. It is not the probability that \( H_0 \) is true, because it is worked out by assuming \( H_0 \) is true. It is not “the probability the result happened by chance”. And it does not measure how big or important an effect is: with a huge sample, a tiny difference can give a tiny p-value.

Testing a proportion

The same four steps work for proportions. The conditions are a random sample with \( np_0 \ge 10 \) and \( n(1-p_0) \ge 10 \).

Worked example

A company claims 65% of its customers are satisfied. A survey of 100 random customers finds 75 satisfied. Is there evidence that satisfaction is above 65%? Use \( \alpha = 0.05 \).

Step 1\( H_0: p = 0.65 \), \( H_a: p > 0.65 \). Check: \( np_0 = 65 \) and \( n(1-p_0) = 35 \), both at least 10
Step 2\( \hat{p} = 0.75 \). \( SE = \sqrt{\dfrac{0.65 \times 0.35}{100}} = \sqrt{0.002275} \approx 0.0477 \)
Step 3\( z = \dfrac{0.75 – 0.65}{0.0477} \approx 2.10 \), right-tail p-value \( \approx 0.018 \)
Step 4\( 0.018 < 0.05 \), so reject \( H_0 \)

There is convincing evidence that more than 65% of customers are satisfied.

Errors, power and the link with intervals

Because you decide from a sample, you can be wrong in two different ways.

\( H_0 \) is actually true\( H_0 \) is actually false
Reject \( H_0 \)Type I error (probability \( \alpha \))Correct decision (power)
Fail to reject \( H_0 \)Correct decisionType II error (probability \( \beta \))

A Type I error is a false alarm, such as deciding a drug works when it does not. In the trial, it convicts an innocent person. A Type II error is a missed detection, such as deciding a drug that really works shows nothing. It acquits a guilty person. Lowering \( \alpha \) from 0.05 to 0.01 makes false alarms rarer, but it also makes real effects easier to miss, so \( \beta \) rises. The right \( \alpha \) depends on which mistake would be worse. For screening a serious disease, missing it is worse, so a higher \( \alpha \) can be sensible.

Key termPower: the probability of correctly rejecting a false \( H_0 \), that is, of detecting a real effect; power \( = 1 – \beta \).

Power rises with a larger sample (the main lever you control), a bigger true effect, less variability in the data, and a larger \( \alpha \). A study with low power will probably miss the very effect it was meant to find, so a non-significant result from it tells you very little.

Intervals and tests agree. A value lies outside a 95% confidence interval exactly when a two-sided test of that value is rejected at \( \alpha = 0.05 \). The battery interval from Step 10 was (475.3, 496.7), which excludes 500, matching the test. The test asks “is this one value believable?” The interval asks “which values are believable?” and shows how big the effect might be, so report both.

Finally, “statistically significant” only means the effect is unlikely to be zero. It does not mean the effect matters. With 100,000 people, a drug that cuts weight by 0.1 kg on average could give \( p < 0.001 \): real, but useless in practice. Always ask two questions: is it real, and is it big enough to care about?

Exam tipWrite every test in four labelled steps: hypotheses (with \( \mu \) or \( p \) defined in context), conditions, calculation (SE, test statistic, df, p-value), and a conclusion in context. Say “reject \( H_0 \)” or “fail to reject \( H_0 \)”, then explain what that means for the real question. The words “accept \( H_0 \)” and “proves” cost marks.

Practise: 6 questions

Try each one on paper first, then check the worked answer. Use the z-table from Step 8 and the t-table from Step 10.

EasyQ1. A delivery firm claims its mean delivery time is 30 minutes; you suspect it is longer. A bottling machine should fill 500 ml, and any change either way is a problem. Write \( H_0 \) and \( H_a \) for each, and say which is one-tailed. Show worked answer
Delivery: \( H_0: \mu = 30 \), \( H_a: \mu > 30 \). This is one-tailed (right-tailed).
Bottling: \( H_0: \mu = 500 \), \( H_a: \mu \ne 500 \). This is two-tailed.
EasyQ2. A test gives \( p = 0.03 \). State the decision at \( \alpha = 0.05 \) and at \( \alpha = 0.01 \). Show worked answer
At \( \alpha = 0.05 \): \( 0.03 \le 0.05 \), so reject \( H_0 \).
At \( \alpha = 0.01 \): \( 0.03 > 0.01 \), so fail to reject \( H_0 \).
The same evidence can lead to different decisions depending on the level you chose in advance.
MediumQ3. \( \bar{x} = 22 \), \( \mu_0 = 25 \), \( s = 6 \), \( n = 25 \). Find \( t \) and its degrees of freedom. Show worked answer
\( SE = 6/\sqrt{25} = 6/5 = 1.2 \).
\( t = (22 – 25)/1.2 = -3/1.2 = -2.50 \).
\( df = 25 – 1 = 24 \).
MediumQ4. A poll of 400 voters finds 55% in favour. Test \( H_0: p = 0.50 \) against \( H_a: p \ne 0.50 \) at \( \alpha = 0.05 \). Show worked answer
Conditions: \( np_0 = 200 \) and \( n(1-p_0) = 200 \), both at least 10.
\( SE = \sqrt{0.5 \times 0.5/400} = \sqrt{0.000625} = 0.025 \).
\( z = (0.55 – 0.50)/0.025 = 2.00 \).
Two-tailed p-value \( = 2 \times (1 – 0.9772) = 0.0456 \).
\( 0.0456 < 0.05 \), so reject \( H_0 \): there is evidence that support differs from 50%.
MediumQ5. A test has power 0.60. (a) What is \( \beta \)? (b) What happens to Type I and Type II error rates if \( \alpha \) is lowered from 0.05 to 0.01? Show worked answer
(a) \( \beta = 1 – 0.60 = 0.40 \).
(b) The Type I error rate falls to 1%. Because stronger evidence is now needed, real effects are missed more often, so \( \beta \) rises and power falls.
ExamQ6. A cereal maker claims boxes average 350 g. A consumer group weighs 25 random boxes and finds \( \bar{x} = 344 \) g and \( s = 10 \) g; the data is roughly symmetric. (a) State hypotheses to test whether boxes are underfilled. [2] (b) Check the conditions. [1] (c) Calculate the test statistic and df. [2] (d) The one-tailed 5% critical value at df = 24 is 1.711. State and interpret the decision. [2] (e) Which type of error could you have made? [1] Show worked answer
(a) \( H_0: \mu = 350 \) g [1]; \( H_a: \mu < 350 \) g, where \( \mu \) is the true mean weight of all boxes [1].
(b) Random sample, and the data is roughly symmetric, which is acceptable for \( n = 25 \) [1].
(c) \( SE = 10/\sqrt{25} = 2 \) [1]; \( t = (344 – 350)/2 = -3.00 \), \( df = 24 \) [1].
(d) \( |-3.00| > 1.711 \), so reject \( H_0 \) [1]. There is convincing evidence that the mean box weight is below the claimed 350 g [1].
(e) Because we rejected \( H_0 \), the only possible mistake is a Type I error (rejecting a true claim) [1].

Check yourself

1. What does a p-value of 0.02 mean?

The p-value is worked out assuming \( H_0 \) is true; it measures how surprising the data is, not the chance \( H_0 \) is true or the size of the effect.

2. A test concludes a drug works when it actually does not. Which error is this?

Rejecting a true null hypothesis is a false alarm, which is a Type I error.

3. A 95% confidence interval for \( \mu \) is (12, 18). Would a two-sided test of \( \mu = 15 \) be rejected at \( \alpha = 0.05 \)?

Values inside a 95% interval are believable, so a two-sided test at the 5% level does not reject them.

Your score: 0 out of 3

The short version

  • Assume \( H_0 \) (no effect, always with an equals sign) and ask whether the data is too surprising to fit with it. Choose \( H_a \) from the question, before you see the data.
  • Test statistic = (estimate − hypothesised value) ÷ standard error: \( t \) for a mean with \( df = n – 1 \); \( z \) for a proportion with the SE built from \( p_0 \).
  • The p-value is the chance of a result at least this extreme if \( H_0 \) is true. If \( p \le \alpha \), reject \( H_0 \); otherwise fail to reject. Never “accept”, and always conclude in context.
  • Type I error (probability \( \alpha \)) rejects a true \( H_0 \); Type II error (probability \( \beta \)) misses a false one. Power \( = 1 – \beta \) rises with sample size. A value outside a 95% interval is rejected by a two-sided 5% test, and statistical significance is not the same as practical importance.
  • The full chapter in Statistics Made Simple has many more worked examples and a full set of tiered practice questions with a complete answer key.
Want more questions like these, with worked answers?
The practice book has hundreds more, graded from easy to exam level.
Next: step 14 of 22Errors and Power in Significance Tests