Menu
Sign up Sign in

AI HL · 13.4

Hypothesis Testing

13.4.14

Hypothesis tests for a mean: mixed practice

13.4.14

Hypothesis tests for a mean: mixed practice

Target: I can choose between a one-sample, a two-sample and a paired test of means, and between z and t, from the wording of a question. (+5 more)

By the end of this section

Key points

Choosing the test

  • Ask three questions. One sample or two? If two, are they paired (the same people or things measured twice) or independent? Is σ known, or only estimated from the sample?
  • σ known: use a z-test with \(\bar X \sim N(\mu, \sigma^2/n)\). σ not known: use a t-test, and the calculator does the work.
  • Paired data: take the differences D and run a one-sample test on D. Two independent samples: use the two-sample test, pooled when the variances are assumed equal.

Distributions you must be able to write down

  • One sample: \(\bar X \sim N(\mu, \sigma^2/n)\). The standard deviation of the sample mean is σ/√n, not σ.
  • Difference of independent variables: \(\mathrm{Var}(A - B) = \mathrm{Var}(A) + \mathrm{Var}(B)\). The variances add even when you subtract.
  • Two independent sample means: \(\bar X_1 - \bar X_2 \sim N\left(\mu_1 - \mu_2,\ \dfrac{\sigma_1^2}{n_1} + \dfrac{\sigma_2^2}{n_2}\right)\). If H0 is μ1 − μ2 = 4, the mean is 4, not 0.
  • Mean of paired differences with known σ for each measurement: \(\bar D \sim N(0,\ 2\sigma^2/n)\) under H0 when both have standard deviation σ.

Estimates, pooling and assumptions

  • A sample variance divides by n. The unbiased estimate of the population variance is \(s^2 = \dfrac{n}{n-1}\times\) sample variance.
  • Pooled estimate: \(s_p^2 = \dfrac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}\), with \(n_1+n_2-2\) degrees of freedom.
  • Paired t-test: the differences are normally distributed. Pooled two-sample t-test: both populations are normal and have equal variance.
  • Central limit theorem: for a large sample (about 30 or more), \(\bar X\) is approximately normal even if the population is not. Say so when a question gives a skewed or unknown distribution.

Why pair, and how to conclude

  • A paired design compares each person or item with itself, so the variation between individuals drops out. A small real difference is easier to detect. It is only possible when the same subjects are measured twice.
  • Compare p with the significance level, or the sample mean with the critical region. Both give the same decision.
  • Write the conclusion in context. 'Insufficient evidence' does not mean H0 is true.

On the calculator

Two-sample t-test from two data lists

  • Enter each sample in its own list.
  • Choose the two-sample t-test with lists, pooled, and the tail from H1.
  • Read t and the p-value.

Screenshot and video to come

Paired t-test from a table

  • Enter the two rows in two lists and make a third list of the differences.
  • Choose the one-sample t-test on the list of differences, with μ0 = 0 and the tail from H1.
  • Read t and the p-value. One-variable statistics of the differences give the mean and s.

Screenshot and video to come

Critical value with the inverse normal

  • Choose the inverse normal. Enter the area to the left, the mean under H0 and the standard deviation of the sample mean (σ/√n, or σ_D/√n for differences).
  • For an upper tail the area is 1 − α. For a lower tail it is α. For two tails use α/2 and 1 − α/2.

Screenshot and video to come

A p-value from a normal or t distribution

  • For a z-test, use the normal cdf with the mean under H0 and the standard deviation of the statistic.
  • For a t-statistic you have formed yourself, use the t cdf with the degrees of freedom.

Screenshot and video to come

Worked examples

Problems like the ones in class. Pick one, try it, then open the working.
Two samples from raw data

A decorator times how long two brands of paint take to dry, in minutes. Brand A is tested on 7 boards and brand B on 8 boards. Assume the drying times are normally distributed with equal variance. Test, at the 5% significance level, whether the mean drying times of the two brands are different.

Item12345678Brand A38.241.536.940.339.842.037.6Brand B43.140.944.542.245.041.743.844.2
Working
  1. Which test

    Two independent samples, variance unknown and assumed equal: two-sample pooled t-test.

    Different boards in each sample, so the samples are not paired. Use the pooled option.

  2. Hypotheses

    H0: μ1 = μ2, H1: μ1 ≠ μ2, where μ1 and μ2 are the population mean drying times, in minutes, of brand A and brand B.

    'Different' makes the test two-tailed.

  3. From the calculator

    Two-sample t-test, data lists, pooled, two-tailed: t = −4.19, p = 0.00105

    Put each sample in its own list. The lists can be different lengths.

  4. Compare

    0.00105 < 0.05, so reject H0.

    Compare p with the full 0.05, not with half of it.

  5. In context

    There is sufficient evidence, at the 5% significance level, that the mean drying times of the two brands are different.

    Say what it means for the paints. The sample mean of brand A is lower, so it dries faster in these samples.

Video walkthrough coming
A one-tailed z-test

The height gain of a variety of sunflower over four weeks is normally distributed with mean 12.4 cm and standard deviation 1.8 cm. A grower uses a new plant food and thinks the mean gain has increased. She assumes the standard deviation is unchanged and measures the gain of a random sample of 15 plants. (a) Write down suitable hypotheses. (b) Find the distribution of the sample mean \(\bar X\) when H0 is true. (c) Find the critical region at the 5% significance level. (d) The sample mean is 13.5 cm. State the conclusion.

Working
  1. Hypotheses

    H0: μ = 12.4, H1: μ > 12.4, where μ cm is the population mean height gain with the plant food.

    She thinks the mean has increased, so the test is upper-tailed. σ is known, so this is a z-test.

  2. Distribution of the sample mean

    Under H0, \(\bar X \sim N(12.4, 1.8^2/15)\), standard deviation \(1.8/\sqrt{15} = 0.465\)

    The sample mean is less spread out than one plant: divide σ by √n.

  3. Critical value

    From the calculator: inverse normal, area 0.95, mean 12.4, standard deviation 0.465: c = 13.2

    5% of sample means lie above this value if H0 is true.

  4. Critical region

    \(\bar X > 13.2\)

    An upper region, because H1 has >.

  5. Decide

    13.5 > 13.2, so reject H0. There is sufficient evidence, at the 5% significance level, that the mean height gain has increased with the plant food.

    The sample mean is in the critical region. The p-value, P(\(\bar X \geq 13.5\)) = 0.00897, agrees: it is below 0.05.

Video walkthrough coming
A two-tailed critical region and the central limit theorem

A jar of honey is labelled 454 g. The mass of a jar has mean 454 g and standard deviation 6.5 g when the filling machine works properly, but the distribution of masses is not known. An inspector weighs a random sample of 45 jars and tests, at the 5% significance level, whether the mean mass has changed. Assume the standard deviation is still 6.5 g. (a) Explain why the inspector can use a test based on the normal distribution. (b) Find the critical region. (c) The sample mean is 452.4 g. State the conclusion.

Working
  1. Why a normal test

    n = 45 is large, so by the central limit theorem \(\bar X\) is approximately normal, whatever the distribution of one jar.

    The masses are not known to be normal, but the mean of a large sample is close to normal. A sample of 30 or more is usually enough.

  2. Hypotheses

    H0: μ = 454, H1: μ ≠ 454

    'Changed' is two-tailed: the region has two parts, with 2.5% in each tail.

  3. Distribution

    Under H0, \(\bar X \approx N(454, 6.5^2/45)\), standard deviation = 0.969

    Divide σ by √n.

  4. Critical values

    From the calculator: inverse normal, areas 0.025 and 0.975, mean 454, standard deviation 0.969: 452.1 and 455.9

    One value below 454 and one above it.

  5. Critical region

    \(\bar X < 452.1\) or \(\bar X > 455.9\)

    Reject H0 if the sample mean lies in either part.

  6. Decide

    452.4 is between 452.1 and 455.9, so do not reject H0. There is insufficient evidence, at the 5% significance level, that the mean mass of a jar has changed.

    452.4 is not in the critical region.

Video walkthrough coming
A two-sample z-test with a difference of 0.6

The yield of wheat, in tonnes per hectare, is normally distributed. For the old variety Y the standard deviation is 0.4 and for the new variety X it is 0.5, and both are known. A farmer believes that variety X gives a mean yield more than 0.6 tonnes per hectare greater than variety Y. She grows X on 30 fields, with mean yield 6.92, and Y on 40 fields, with mean yield 6.15. (a) Explain why a two-sample z-test can be used. (b) Test her belief at the 5% significance level.

Working
  1. Why z

    The two samples are independent, the populations are normal and both standard deviations are known.

    Known σ means a z-test, not a t-test. The samples are different fields, so they are not paired.

  2. Hypotheses

    H0: μX − μY = 0.6, H1: μX − μY > 0.6, where μX and μY are the population mean yields of X and Y.

    H0 states the difference she claims to beat. The hypothesised difference is not zero.

  3. Distribution

    Under H0, \(\bar X_X - \bar X_Y \sim N\left(0.6,\ \dfrac{0.5^2}{30} + \dfrac{0.4^2}{40}\right)\), standard deviation = 0.111

    The variances of independent sample means add, even for a difference.

  4. p-value

    Observed difference = 6.92 − 6.15 = 0.77. From the calculator: normal cdf from 0.77 to ∞, mean 0.6, standard deviation 0.111: p = 0.0629

    Upper tail, because H1 has >.

  5. Conclusion

    0.0629 > 0.05, so do not reject H0. There is insufficient evidence, at the 5% significance level, that variety X gives a mean yield more than 0.6 tonnes per hectare greater than variety Y.

    The sample difference, 0.77, is bigger than 0.6, but not by enough to rule out chance.

Video walkthrough coming
Paired differences with a known standard deviation

A coach thinks that running on grass is slower than running on the track. Nine athletes each run 100 m on the track (T) and on grass (G). The times, in seconds, are shown. Each time is normally distributed with standard deviation 0.3 s, and the times are independent. Let D = G − T. (a) Write down hypotheses and form the differences D. (b) Find the variance of D, and the distribution of \(\bar D\) when H0 is true. (c) Find the critical region at the 5% significance level and state the conclusion.

ItemABCDEFGHITrack T11.812.111.512.611.912.311.712.012.4Grass G12.112.211.912.812.212.412.112.312.5
Working
  1. Differences and hypotheses

    D = G − T: 0.3, 0.1, 0.4, 0.2, 0.3, 0.1, 0.4, 0.3, 0.1. H0: μD = 0, H1: μD > 0, where μD s is the population mean of G − T.

    The coach thinks grass is slower, so G − T is positive on average. Test the differences, not the two samples.

  2. Variance of D

    Var(D) = Var(G) + Var(T) = 0.3² + 0.3² = 0.180

    Var(G − T) = Var(G) + Var(T) for independent times. The variances add, they are not subtracted.

  3. Distribution of the mean difference

    Under H0, \(\bar D \sim N(0, 0.180/9)\), standard deviation = 0.141

    Divide the variance of D by n = 9.

  4. Critical region

    From the calculator: inverse normal, area 0.95, mean 0, standard deviation 0.141: c = 0.233. Critical region: \(\bar D > 0.233\)

    Upper tail, because H1 has >.

  5. Decide

    \(\bar D = 0.244\) > 0.233, so reject H0. There is sufficient evidence, at the 5% significance level, that the mean time on grass is greater than on the track.

    The sample mean difference is in the critical region. The p-value is 0.0420, which is below 0.05.

Video walkthrough coming
A paired t-test

A typing course claims to raise speed. The typing speeds, in words per minute, of 8 students are recorded before and after the course. (a) Explain why a paired test is suitable. (b) Form the differences, after − before, and find their mean and standard deviation. (c) Test, at the 5% significance level, whether the course raises the mean speed. State the assumption you make.

Item12345678Before4138455236474044After4439475240484345
Working
  1. Why paired

    The same 8 students are measured twice, so each 'before' belongs with one 'after'. The two samples are not independent.

    Pairing removes the large differences in speed between students and leaves the effect of the course.

  2. Differences

    D = after − before: 3, 1, 2, 0, 4, 1, 3, 1. Mean = 1.88, s = 1.36

    From the calculator, one-variable statistics of the list D. s is the sample standard deviation.

  3. Hypotheses

    H0: μD = 0, H1: μD > 0, where μD is the population mean increase in speed, in words per minute.

    The course should raise the speed, so after − before is positive.

  4. From the calculator

    t-test on the list D (or paired t-test), μ0 = 0, upper tail: t = 3.91, p = 0.00291

    The calculator gives t and p for the upper tail.

  5. Conclusion

    0.00291 < 0.05, so reject H0. There is sufficient evidence, at the 5% significance level, that the course raises the mean typing speed.

    Compare p with 0.05.

  6. Assumption

    The population of differences is normally distributed.

    For a pooled two-sample test you would assume two normal populations with equal variance. A paired test needs only one assumption: the differences are normal.

Video walkthrough coming
A pooled test with a difference of 4 minutes

Mia believes that her new cycling route to school is more than 4 minutes quicker, on average, than the old route. She times 10 journeys on the old route (mean 34.8 minutes, sample variance 9.6) and 12 journeys on the new route (mean 29.1 minutes, sample variance 7.2). Assume the journey times are normally distributed with equal variance. Test her belief at the 10% significance level.

Working
  1. Unbiased estimates

    s1² = 10/9 × 9.6 = 10.7, s2² = 12/11 × 7.2 = 7.85

    A sample variance divides by n. The estimate of the population variance multiplies it by n/(n − 1).

  2. Hypotheses

    H0: μ1 − μ2 = 4, H1: μ1 − μ2 > 4, where μ1 and μ2 minutes are the population mean journey times on the old and new route.

    Old route is group 1. 'More than 4 minutes quicker' means the old mean is more than 4 greater.

  3. Pooled estimate

    sp² = (9 × 10.7 + 11 × 7.85) / 20 = 9.12

    Combine the two estimates, weighting each by its degrees of freedom. Total degrees of freedom = 10 + 12 − 2 = 20.

  4. Test statistic

    t = (34.8 − 29.1 − 4) / √(9.12 × (1/10 + 1/12)) = 1.31

    The calculator's two-sample test only tests a difference of 0, so use it for the pooled estimate and form t yourself.

  5. p-value

    From the calculator: t cdf, 20 degrees of freedom, upper tail from 1.31: p = 0.102

    Upper tail, because H1 has >.

  6. Conclusion

    0.102 > 0.1, so do not reject H0. There is insufficient evidence, at the 10% significance level, that the new route is more than 4 minutes quicker, on average.

    Compare p with 0.10.

Video walkthrough coming