Hypothesis Testing — Revision Summary

The four tests you need: Student's t-test for one mean, the pooled two-sample t-test, the χ² goodness of fit test, and the χ² test for independence — with the decision rules, degrees of freedom and the traps that cost marks.

Which test do I need?

Read the question for two things: what kind of data you have, and how many groups.

The situationThe testDegrees of freedom
One sample of measurements; a claim about the population mean One-sample t-test df = n − 1
Two independent samples of measurements; are the two population means different? Two-sample (pooled) t-test handled by technology
Counts in categories of one variable, compared with claimed proportions or a model χ² goodness of fit df = k − 1
Counts cross-classified by two variables in a contingency table χ² test for independence df = (r − 1)(c − 1)
Quick discriminator: if the data are measurements you can average, you want a t-test. If the data are tallies of how many fell into each category, you want a χ² test.

The framework every test shares

Learn this once and only the middle step changes between tests.

  1. Write the null hypothesis H0 and the alternative H1, defining any symbols you use.
  2. Write the significance level α. Fix it now, before you touch the data.
  3. Compute the test statistic from the sample (t or χ²calc).
  4. Find the p-value, using the correct degrees of freedom.
  5. Compare: reject H0 when p-value ≤ α, otherwise there is not enough evidence to reject it.
  6. Write a sentence in context saying what that means for the situation in the question.

The two definitions to know cold

p-value — the probability of getting a sample result at least as extreme as the one you got, if H0 were true. A small p-value means your data would be surprising under H0, so H0 looks doubtful.
Significance level α — the threshold you agree to in advance. It is also the probability of rejecting H0 when H0 is actually true, so α = 0.05 means accepting a 1-in-20 risk of a false alarm.
A test never proves anything. Rejecting H0 means the evidence against it was strong enough; not rejecting H0 means the evidence was too weak — not that H0 is true.

Writing the hypotheses

H0 is always an equality — a specific value, no inequality signs.

H0: μ = μ0

The alternative carries the direction, and you choose it from the point of view of whoever wants the evidence:

H1TailsWords in the question that point to it
μ > μ₀one (upper)increased, faster, longer, exceeds, heavier, an improvement
μ < μ₀one (lower)reduced, quicker, lighter, under-filled, worse than
μ ≠ μ₀twohas changed, differs from, is the stated value correct?

The same context can generate all three. If a factory claims its packets hold 500 g: the factory testing its own machine wants "has it drifted?" (two-tailed); a consumer group suspecting short measure wants μ < 500 (one-tailed); an engineer checking for overfilling wants μ > 500 (one-tailed).

For the two-sample test the same logic applies to H₀: μ₁ = μ₂ against μ₁ < μ₂, μ₁ > μ₂ or μ₁ ≠ μ₂. Always state clearly which population is 1 and which is 2 — half the marks lost on this topic come from not defining that.

Testing one mean — Student's t-test

One sample of measurements against a claimed population mean. The population is assumed approximately normally distributed.

t = ( xμ0 ) ÷ ( s ∕ √n )   with   T ~ tn−1

The top measures how far the sample mean sits from the claim; dividing by s/√n asks whether that gap is large relative to how much the data naturally vary. A gap of 2 g means little in noisy data and a lot in tight data.

Which tail gives the p-value

H₁p-valueWhy
μ > μ₀P(T ≥ t)only large positive t supports H₁
μ < μ₀P(T ≤ t)only large negative t supports H₁
μ ≠ μ₀2 × P(T ≥ |t|)both tails count; the curve is symmetric

Worked example — bus journey times

A timetable is based on a mean journey time of 24 minutes. After a bus lane opens, 45 randomly chosen journeys have mean 22.8 minutes with standard deviation 3.6 minutes. Test at the 5% level whether journeys are now quicker.

1. H₀: μ = 24 (no change), H₁: μ < 24 (quicker). 2. α = 0.05.
3. t = (22.8 − 24) ÷ (3.6/√45) ≈ −2.24, with T ~ t₄₄.
4. One-tailed, lower: p = P(T ≤ −2.24) ≈ 0.0152.
5. 0.0152 ≤ 0.05, so reject H₀.
6. There is sufficient evidence at the 5% level that mean journey time has fallen below 24 minutes.

Worked example — a two-tailed version

A machine should dispense 330 ml. A sample of 25 cups has mean 327.4 ml, standard deviation 4.9 ml. Test at the 5% level whether the machine needs recalibrating.

H₀: μ = 330, H₁: μ ≠ 330; t = (327.4 − 330) ÷ (4.9/√25) ≈ −2.65, T ~ t₂₄, p = 2 × P(T ≥ 2.65) ≈ 0.0139 ≤ 0.05 → reject H₀: there is evidence the mean dispensed volume differs from 330 ml, so the machine should be recalibrated.

On the calculator: use the T-Test menu. You can enter raw data from a list, or summary statistics (μ₀, x̄, s, n). Select the H₁ option (<μ₀ , ≠μ₀ , >μ₀) that matches your alternative — that choice is what decides the tail, and getting it wrong roughly halves or doubles your p-value.
Background: the t-distribution is symmetric about 0 and flatter than the standard normal, with heavier tails; as n grows it converges to N(0, 1²). It was published in 1908 by W. S. Gosset, writing under the pen name "Student".

Comparing two means — the pooled two-sample t-test

Two independent samples, and the question is whether the two population means differ.

H0: μ1 = μ2  (equivalently μ1μ2 = 0)
H1: μ1 < μ2  or  μ1 > μ2  or  μ1μ2

Worked example — two brands of rechargeable battery

18 cells of brand P last a mean 6.42 hours (s = 0.55); 20 cells of brand Q last a mean 6.91 hours (s = 0.61). Test at the 5% level the claim that brand Q lasts longer.

Let μ₁ be the mean life of brand P cells and μ₂ that of brand Q.
H₀: μ₁ = μ₂, H₁: μ₁ < μ₂; α = 0.05.
Pooled two-sample test: t ≈ −2.59, p ≈ 0.0069 ≤ 0.05 → reject H₀.
There is sufficient evidence at the 5% level that brand Q cells last longer on average than brand P.

The χ² goodness of fit test

Counts in k categories of a single variable, tested against claimed proportions — is a spinner fair, do sales match last year's split, does a model fit? ("χ" is chi, said "ki".)

H0: p1 = p01, p2 = p02, …, pk = p0k
H1: at least one pip0i

Note the asymmetry: H0 pins down every proportion, but H1 only claims that somewhere the model fails. A rejected test tells you the model is wrong, not which category broke it.

χ²calc = Σ ( fobsfexp )² ∕ fexp   ·   fexp = n × p0i   ·   df = k − 1

Squaring makes every discrepancy positive; dividing by fexp judges each one relative to how big that category should have been — being 10 out on an expected 20 matters far more than being 10 out on an expected 500. Big disagreement gives a big χ²calc, so:

p-value = P(χ² ≥ χ²calc) — always the upper tail, for every χ² test, whatever the wording of the question.

Why k − 1 degrees of freedom? The proportions must total 1, so once k − 1 of them are known the last is forced: only k − 1 values are free to vary.

Worked example — is the spinner fair?

A four-sector spinner is spun 120 times, landing on red 22, blue 39, green 31 and yellow 28 times. Test at the 5% level whether the spinner is fair.

H₀: p₁ = p₂ = p₃ = p₄ = ¼; H₁: at least one proportion is not ¼. Each fexp = 120 × ¼ = 30.

Sectorfobsfexp fobs − fexp(fobs − fexp (fobs − fexp)² ⁄ fexp
Red2230−8642.133
Blue39309812.700
Green3130110.033
Yellow2830−240.133
χ²calc =5.00

df = 4 − 1 = 3, so p = P(χ² ≥ 5.00) ≈ 0.172 > 0.05 → do not reject H₀. There is insufficient evidence at the 5% level that the spinner is unfair.

Worked example — unequal claimed proportions

A developer claims its app's star ratings split 30% / 25% / 25% / 12% / 8% across 5 stars down to 1 star. A sample of 200 reviews gives 46, 58, 71, 15, 10. Test the claim at the 5% level.

Expected frequencies are 200 × 0.30 = 60, then 50, 50, 24 and 16. Summing (fobs − fexp)²/fexp gives χ²calc ≈ 18.99 with df = 5 − 1 = 4, so p ≈ 0.0008 ≤ 0.05 → reject H₀: the ratings do not follow the claimed split.

The small-expected-frequency rule. χ² is only a reliable approximation when every expected frequency is at least 5. If some fall below 5, combine neighbouring or similar categories (e.g. merge "4 or more" into one bin) and redo the test — and remember that fewer categories means a smaller df.

The χ² test for independence

A single sample cross-classified by two categorical variables in a contingency table with r rows and c columns. Are the variables related?

H0: the two variables are independent
H1: the two variables are not independent (they are dependent / associated)

Independence means P(A ∩ B) = P(A) × P(B). Applying that to each cell and multiplying by the sample size collapses to a rule you can apply straight to the table:

fexp = ( row total × column total ) ∕ grand total   ·   df = (r − 1)(c − 1)

Count r and c from the data cells only — the row and column of totals are not rows and columns of the table. The df formula comes from the same "free to vary" idea: once you fix (r − 1)(c − 1) cells, the totals force all the rest.

The test statistic is the same sum as before, and again only the upper tail is used.

Worked example — revision method and year group

200 students were asked whether they mainly revise with flashcards or with past papers:

Year 11Year 12Year 13Total
Flashcards455421120
Past papers15263980
Total608060200

1. H₀: revision method and year group are independent; H₁: they are not independent. 2. α = 0.05. 3. df = (2 − 1)(3 − 1) = 2.
4. Expected frequencies, e.g. top left = 120 × 60 ÷ 200 = 36:

Year 11Year 12Year 13
Flashcards364836
Past papers243224

All are at least 5, so the test is valid, and χ²calc = 2.25 + 0.75 + 6.25 + 3.375 + 1.125 + 9.375 ≈ 23.1.
5. p = P(χ² ≥ 23.1) ≈ 0.00001. 6. p ≤ 0.05 → reject H₀.
7. There is strong evidence at the 5% level that revision method is associated with year group — the table suggests a shift towards past papers in the older years.

On the calculator: enter the observed counts as a matrix and use the χ² Test, which returns χ²calc, the p-value, df and the expected frequency matrix — useful for checking the "all expected ≥ 5" condition.

Yates' continuity correction (extension)

With a 2 × 2 table, df = 1 and the ordinary χ² approximation tends to overstate the evidence. The correction shrinks each discrepancy by 0.5 before squaring:

When df = 1:   χ²calc = Σ ( | fobsfexp | − 0.5 )² ∕ fexp

Worked example — the correction in action

A 2 × 2 table has observed counts 26, 14 / 24, 36, with row totals 40 and 60 and column totals 50 and 50 from 100 people. Expected frequencies are 20, 20 / 30, 30, so every discrepancy is 6.

Uncorrected: χ²calc = 4 × 36/fexp summed = 6.00.
With Yates: each (6 − 0.5)² = 30.25, giving χ²calc ≈ 5.04 — smaller, as the correction always is.
At the 5% level with df = 1 the critical value is 3.84, and 5.04 ≥ 3.84, so H₀ is still rejected.

Calculators do not apply Yates' correction, so when a question asks for it you must build the table and compute χ²calc by hand, then decide using the critical value rather than a p-value.

Two ways to decide: p-value or critical value

They are the same rule seen from opposite ends, and must always agree.

p-value route

Compute the p-value from the test statistic, then compare with α.

Reject H0 if p-value ≤ α.

Needs technology, but tells you how much evidence you have, not just yes or no.

Critical value route

χ²crit is the value of the statistic whose p-value is exactly α. Anything beyond it has a smaller p-value.

Reject H0 if χ²calc ≥ χ²crit — the rejection inequality.

Needs only a table, and is the required route when using Yates' correction.

χ²crit depends on both the degrees of freedom and the significance level:

dfα = 10%α = 5%α = 2.5%α = 1%
12.713.845.026.63
24.615.997.389.21
36.257.819.3511.34
47.789.4911.1413.28
59.2411.0712.8315.09
610.6412.5914.4516.81
712.0214.0716.0118.48
813.3615.5117.5320.09
914.6816.9219.0221.67
1015.9918.3120.4823.21
1117.2819.6821.9224.72
1218.5521.0323.3426.22
1319.8122.3624.7427.69
1421.0623.6826.1229.14
1522.3125.0027.4930.58

Upper-tail critical values of the χ² distribution, to 2 d.p. Read across from your df to the column for your significance level.

Traps and good practice

Set α before you look

Choosing the significance level after seeing the p-value — so that the answer comes out the way you hoped — invalidates the test. The threshold is a promise made in advance.

One tail or two

The commonest arithmetic slip. A two-tailed p-value is twice the one-tailed one, which can flip the decision. Match the tail to H₁, and set the calculator's H₁ option accordingly.

Use the right df

n − 1 for a one-sample t-test, k − 1 for goodness of fit, (r − 1)(c − 1) for independence. Counting the totals row as a row is a classic error.

Check expected frequencies

Any expected frequency below 5 undermines a χ² test. Say so, combine categories, recompute df, and comment that the second result is the more reliable one.

Association is not cause

Rejecting independence says the two variables are related in this population; it says nothing about one causing the other. A lurking third variable is always a candidate.

Testing many things at once

Every test at the 5% level has a 5% chance of a false alarm when H0 is true. Run 100 such tests on unrelated questions and you should expect about 5 "significant" results from chance alone — so a single striking finding picked out of many comparisons means little until it is replicated.

Write the conclusion in context

"There is sufficient evidence at the 5% level to support the claim that…" followed by what that means for the buses, batteries or students in the question. A bare "reject H0" rarely earns the final mark.

Sketch the tail

A quick curve with the relevant area shaded takes seconds and catches a wrong tail, a mis-set calculator option, or a p-value that cannot possibly be right.