Why compare two means?
Many questions compare two groups on a quantitative variable. Do bags from one factory weigh more than bags from another? Are gym sessions at one branch longer than at another? Does a caffeine drink help people cycle further? Each question is about a difference between two population means, μ₁ − μ₂.
You usually cannot measure everyone, so you take a sample from each group and find the two sample means, x̄₁ and x̄₂. Their difference, x̄₁ − x̄₂, estimates μ₁ − μ₂. Just like one sample mean (Topic 4.1), this difference changes from sample to sample. The distribution of x̄₁ − x̄₂ over all possible pairs of samples is its sampling distribution. This topic gives you its centre, its spread and the conditions for its shape to be normal.
Keep the notation straight:
| Symbol | Meaning | Type |
|---|---|---|
| μ₁, μ₂ | mean of population 1 and population 2 | parameters |
| σ₁, σ₂ | standard deviation of population 1 and population 2 | parameters |
| N₁, N₂ | sizes of population 1 and population 2 | population sizes |
| n₁, n₂ | sizes of sample 1 and sample 2 | sample sizes |
| x̄₁, x̄₂ | mean of sample 1 and sample 2 | statistics |
| x̄₁ − x̄₂ | difference in sample means | statistic (estimates μ₁ − μ₂) |
Choose an order of subtraction at the start, state it, and keep it. “Gym A − Gym B” is clear; “the difference” on its own is not.
Mean and standard deviation of x̄₁ − x̄₂
Suppose the two samples are independent of each other and the values within each sample are independent. Then the sampling distribution of x̄₁ − x̄₂ has:
- Mean: μ(x̄₁ − x̄₂) = μ₁ − μ₂
- Standard deviation: σ(x̄₁ − x̄₂) = √(σ₁²/n₁ + σ₂²/n₂)
Why these make sense:
- The mean. From Topic 4.1, the mean of x̄₁ is μ₁ and the mean of x̄₂ is μ₂. On average, the difference is the difference of the averages. So x̄₁ − x̄₂ is an unbiased estimator of μ₁ − μ₂.
- The standard deviation. σ₁²/n₁ is the variance of x̄₁ and σ₂²/n₂ is the variance of x̄₂. The variances add, even though the means are subtracted, because each sample brings its own random error and the errors do not cancel.
Two warnings follow:
- Do not add or subtract the two standard deviations. Add the two variances, then take one square root.
- The standard deviation of the difference is always larger than the standard deviation of either sample mean on its own.
Larger samples still give less variability. If you multiply both sample sizes by 4, both variances are divided by 4, so the standard deviation is halved.
The conditions and what each one is for
Check each condition in context, with numbers.
| Condition | What to check | What it guarantees |
|---|---|---|
| Randomization | Two independent random samples, one from each population; or, in an experiment, treatments randomly assigned to the experimental units | The samples are independent and x̄₁ − x̄₂ is unbiased |
| 10% | When sampling without replacement: n₁ ≤ 10% of N₁ and n₂ ≤ 10% of N₂ | Values within each sample are close enough to independent for the standard deviation formula |
| Shape | Both populations normal → the sampling distribution is normal (any sample sizes). Populations not normal → it is approximately normal if n₁ ≥ 30 and n₂ ≥ 30 | You may use a normal model for probabilities |
Points that cost marks:
- Experiments. If the data come from an experiment, the independence requirement is met by random assignment of the treatments. The 10% condition is not needed, because no one is sampled from a larger population. You still need the shape condition before using a normal model.
- Both samples. “n₁ + n₂ ≥ 30” is not the rule. Each sample must have at least 30 values when the populations are not normal.
- Paired data are not independent samples. If the same individuals are measured twice, take differences and use one-sample methods (Topics 4.2 to 4.5). The formula in this topic does not apply.
Picturing the sampling distribution
Worked example 1: normal populations, small samples
Question. Two fictional factories fill bags of rice labelled 1 kg. At Factory P, fill weights are normally distributed with mean 1,004 g and standard deviation 6 g. At Factory Q, they are normally distributed with mean 1,000 g and standard deviation 8 g. An inspector selects a random sample of 10 of the 5,000 bags Factory P filled on one day and, independently, a random sample of 12 of the 8,000 bags Factory Q filled that day.
(a) Find the mean and standard deviation of the sampling distribution of x̄P − x̄Q. (b) Check the conditions for a normal model. (c) Interpret the mean and the standard deviation. (d) Find the probability that the Factory Q sample mean is greater than the Factory P sample mean.
(a)
- Mean: μP − μQ = 1,004 − 1,000 = 4 g.
- Variance of x̄P: 6² ÷ 10 = 3.6. Variance of x̄Q: 8² ÷ 12 ≈ 5.3333.
- Add: 3.6 + 5.3333 = 8.9333.
- Standard deviation: √8.9333 ≈ 2.9889 g.
(b)
- Randomization: independent random samples from the two factories. ✓
- 10%: 10 ≤ 10% of 5,000 = 500 and 12 ≤ 10% of 8,000 = 800. ✓
- Shape: both populations of fill weights are normal, so the sampling distribution of x̄P − x̄Q is normal, even though both samples are small. ✓
(c) Mean: over all possible pairs of random samples (10 bags from P, 12 from Q), the difference in sample mean fill weights (P − Q) averages 4 g, the true difference between the two factories’ mean fill weights. Standard deviation: the difference in sample means (P − Q) typically varies from 4 g by about 2.99 g.
(d) “Q greater than P” means x̄P − x̄Q < 0.
- z = (0 − 4) ÷ 2.9889 ≈ −1.3383.
- P(x̄P − x̄Q < 0) ≈ 0.0904.
So in about 9% of such pairs of samples, the Factory Q sample would have the larger mean, even though Factory P’s true mean is 4 g higher.
Check. The separate standard deviations are 6/√10 ≈ 1.8974 g and 8/√12 ≈ 2.3094 g. The answer, 2.9889 g, is larger than each but smaller than their sum (4.2068 g), as it must be when variances add.
Worked example 2: skewed populations, large samples
Question. Two branches of a fictional gym record how long each session lasts. Session lengths are skewed to the right at both branches. At Gym A (9,000 sessions last month), μA = 62 minutes and σA = 18 minutes. At Gym B (7,500 sessions), μB = 55 minutes and σB = 15 minutes. A manager takes independent random samples of 40 Gym A sessions and 50 Gym B sessions from last month.
(a) Find the mean and standard deviation of x̄A − x̄B and justify a normal model. (b) Find the probability that the Gym A sample mean is at least 10 minutes greater than the Gym B sample mean. (c) The manager’s samples give x̄A = 71.4 and x̄B = 56.2 minutes. Is this difference surprising?
(a) Mean = 62 − 55 = 7 minutes. Standard deviation = √(18²/40 + 15²/50) = √(8.1 + 4.5) = √12.6 ≈ 3.5496 minutes.
- Randomization: independent random samples from each gym. ✓
- 10%: 40 ≤ 900 and 50 ≤ 750. ✓
- Shape: the populations are skewed, not normal, but nA = 40 ≥ 30 and nB = 50 ≥ 30, so the sampling distribution is approximately normal. ✓
(b)
- z = (10 − 7) ÷ 3.5496 ≈ 0.8452.
- P(x̄A − x̄B ≥ 10) ≈ 0.1990 (the hatched tail in Figure 1).
Interpretation: if the stated means and standard deviations are correct, about 20% of pairs of random samples of these sizes would show a Gym A mean at least 10 minutes greater than the Gym B mean.
(c) x̄A − x̄B = 71.4 − 56.2 = 15.2 minutes.
- z = (15.2 − 7) ÷ 3.5496 ≈ 2.3101.
- P(x̄A − x̄B ≥ 15.2) ≈ 0.0104.
If the true difference were 7 minutes, a sample difference of 15.2 minutes or more would happen in only about 1% of pairs of samples. That is unusual, so the samples give reason to doubt the stated values. They do not prove them wrong: unusual samples do happen. Formal tests come in Topics 4.9 and 4.10.
Check. normalcdf(10, 1000, 7, 3.5496) ≈ 0.1990. The chance that the Gym B sample mean is the larger one is P(x̄A − x̄B ≤ 0) ≈ 0.0243, the small area left of “no difference” in Figure 1.
Worked example 3: an experiment
Question. A fictional sports scientist randomly assigns 70 volunteers, 35 to a caffeine drink (C) and 35 to a placebo drink (P). Each then cycles for 20 minutes on a static bike. Suppose that, for people like these volunteers, distance cycled has mean 9.4 km and standard deviation 1.2 km with caffeine, and mean 8.9 km and standard deviation 1.1 km with the placebo.
(a) Check the conditions for a normal model for x̄C − x̄P. (b) Find the probability that the placebo group cycles at least as far, on average, as the caffeine group. (c) What happens with 70 volunteers in each group?
(a)
- Randomization: the drinks were randomly assigned to the volunteers. ✓ The 10% condition is not needed: this is an experiment, not a sample from a population.
- Shape: the distance distributions are not stated to be normal, but both groups have 35 ≥ 30 volunteers, so the sampling distribution is approximately normal. ✓
(b) Mean = 9.4 − 8.9 = 0.5 km. Standard deviation = √(1.2²/35 + 1.1²/35) ≈ 0.2752 km. “Placebo at least as far” means x̄C − x̄P ≤ 0. z = (0 − 0.5) ÷ 0.2752 ≈ −1.8171, so the probability is about 0.0346. Even if caffeine adds 0.5 km on average, about 3.5% of experiments like this would show no advantage.
(c) With 70 per group, both variances halve, so the standard deviation is divided by √2: about 0.1946 km. Then z ≈ −2.5698 and the probability falls to about 0.0051. Larger groups make a misleading result much less likely.
When the normal model is not justified
Suppose the gyms in Worked example 2 had samples of only 15 and 20 sessions. The populations are skewed and neither sample has 30 values, so you cannot assume x̄A − x̄B is approximately normal. The mean (7 minutes) and standard deviation formulas still hold, because they need only independence, but do not use a normal model for probabilities.
Common misconceptions
- Adding the standard deviations or subtracting the variances. Use √(σ₁²/n₁ + σ₂²/n₂).
- Using n₁ + n₂ as one sample size. Each variance uses its own sample size.
- “n₁ + n₂ ≥ 30 is enough.” For non-normal populations, each sample needs at least 30 values.
- Requiring large samples when both populations are normal. If both populations are normal, x̄₁ − x̄₂ is normal for any sample sizes.
- Checking the 10% condition for an experiment. Random assignment replaces it.
- Using this formula for paired data. The same individuals measured twice give one sample of differences.
- Not stating the order of subtraction. A mean of −4 g and a mean of 4 g describe the same situation in different orders.
- “A small probability proves the stated values are wrong.” It gives reason to doubt them; it is not proof.
Where this leads
In practice μ₁, μ₂, σ₁ and σ₂ are unknown. Next, in Topic 4.7, Constructing a Confidence Interval for the Difference Between Two Population Means, you replace σ₁ and σ₂ with s₁ and s₂ and use a t critical value. Try the practice questions now, then use the revision notes and the checklist to consolidate. For the same ideas with proportions, see the Topic 3.9 study guide.
Quick questions
Why do the variances add when the means are subtracted?
Each sample mean varies on its own, and the two samples are independent. When you subtract, the random variation from both samples ends up in the difference, so it cannot cancel out. As background: for independent random variables, the variance of a difference is the sum of the variances.
What if only one of the samples has 30 or more values?
For populations that are not normal, the course rule needs both n₁ ≥ 30 and n₂ ≥ 30. If one sample is small and its population is skewed, do not use a normal model for x̄₁ − x̄₂.
Does this topic use s or σ?
σ. Here the population means and standard deviations are given, and you describe how x̄₁ − x̄₂ behaves. From Topic 4.7 onwards the parameters are unknown, so you estimate the standard deviation with s₁ and s₂ and use t-procedures.