This note covers unbiased estimates from a sample, confidence intervals for a population mean when the population standard deviation is unknown, and \(t\)-tests (one-sample and two-sample pooled). These methods let you draw conclusions about a whole population from small samples, which is how quality checks and trials are usually done.
Key ideas
We rarely know the true mean \(\mu\) or variance \(\sigma^2\) of a population. We estimate them from a sample of size \(n\).
- The sample mean \(\bar{x}\) is an unbiased estimate of \(\mu\).
- The unbiased estimate of \(\sigma^2\) is the sample variance with divisor \(n-1\), written \(s_{n-1}^2\). The GDC usually labels \(s_{n-1}\) as "sx" or "\(s_x\)". The population-style value with divisor \(n\), \(\sigma_n\), is slightly too small as an estimate.
When \(\sigma\) is unknown, we replace it with \(s_{n-1}\). This adds extra uncertainty, so we use the \(t\)-distribution instead of the normal. It is also bell-shaped and symmetrical but has heavier tails, and it depends on the degrees of freedom \(\nu=n-1\). As \(\nu\) grows it becomes closer to the normal. The methods assume the population is (approximately) normal.
Confidence interval for a mean. A 95% confidence interval is built so that, over many samples, about 95% of such intervals would contain \(\mu\). It does not mean there is a 95% chance that \(\mu\) lies in one particular interval. A higher confidence level gives a wider interval. A larger sample gives a narrower interval.
One-sample \(t\)-test. Test a claim about \(\mu\).
- \(H_0:\mu=\mu_0\). \(H_1\) is \(\mu\neq\mu_0\) (two-tailed), \(\mu\lt\mu_0\) or \(\mu\gt\mu_0\) (one-tailed).
- Compute \(t\) and the \(p\)-value (GDC: one-sample \(t\)-test with the correct alternative). Reject \(H_0\) if the \(p\)-value is below the significance level.
Two-sample pooled \(t\)-test. This test is also part of SL, where it is used with the GDC and the \(p\)-value; the rest of this note is HL. Compare the means of two independent samples. It assumes both populations are normal with the same variance, so the two sample variances are combined (pooled). \(H_0:\mu_1=\mu_2\). On the GDC choose the two-sample \(t\)-test and set "pooled" to yes.
Choosing and reading the output. Use the \(t\)-distribution whenever the population standard deviation is estimated from the sample. For a one-tailed test, the \(p\)-value is half of the two-tailed value when the sample difference lies in the direction of \(H_1\). A confidence interval and a two-tailed test at the matching level agree: if \(\mu_0\) lies outside the 95% interval, the 5% two-tailed test rejects \(H_0:\mu=\mu_0\). The pooled test is only sensible when the two sample variances are of similar size.
Definitions and formulae
| Term or formula | Meaning / when to use |
|---|---|
| \(\bar{x}=\dfrac{\sum x}{n}\) | Unbiased estimate of the population mean. |
| \(s_{n-1}^2=\dfrac{\sum (x-\bar{x})^2}{n-1}\) | Unbiased estimate of the population variance. |
| \(\nu=n-1\) | Degrees of freedom for one sample. |
| \(\bar{x}\pm t_{\nu}\dfrac{s_{n-1}}{\sqrt{n}}\) | Confidence interval for \(\mu\) when \(\sigma\) is unknown. \(t_\nu\) is the critical value with the chosen confidence level (for 95%, the value with 2.5% in each tail). |
| \(t=\dfrac{\bar{x}-\mu_0}{s_{n-1}/\sqrt{n}}\) | Test statistic for a one-sample \(t\)-test. |
| \(s_p^2=\dfrac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2}\) | Pooled variance estimate. |
| \(t=\dfrac{\bar{x}_1-\bar{x}_2}{s_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}\) | Test statistic for the pooled two-sample test, with \(\nu=n_1+n_2-2\). |
| \(p\)-value | Probability of a result at least as extreme as the one observed if \(H_0\) is true. For a two-tailed test it counts both tails. |
Worked examples
Example 1 The battery life of a random sample of 12 tablets has mean 31.4 hours and \(s_{n-1}=2.6\) hours. Assuming the lives are normally distributed, find a 95% confidence interval for the mean battery life.
\(n=12\), so \(\nu=11\). Use the inverse \(t\) function on the GDC (or the confidence interval feature) with area 0.975 and \(\nu=11\): \(t=2.201\).
Margin of error \(=2.201\times\frac{2.6}{\sqrt{12}}=2.201\times 0.7506\approx 1.652\).
Interval: \(31.4-1.652=29.75\) to \(31.4+1.652=33.05\).
Answer: (29.7, 33.1) hours.
Example 2 A packing machine is meant to fill rice bags with 500 g. A sample of 10 bags has masses (g): 498, 503, 491, 487, 495, 500, 489, 493, 496, 490. Test at the 5% level whether the machine underfills, assuming a normal population.
\(H_0:\mu=500\). \(H_1:\mu\lt 500\) (one-tailed, because the concern is underfilling).
From the data (GDC one-variable statistics): \(\bar{x}=494.2\), \(s_{n-1}=5.138\), \(n=10\), \(\nu=9\).
\(t=\frac{494.2-500}{5.138/\sqrt{10}}=\frac{-5.8}{1.6249}\approx -3.57\).
The one-sample \(t\)-test feature with alternative "\(\lt\)" gives \(p\approx 0.00301\).
Since \(0.00301\lt 0.05\), reject \(H_0\).
Answer: \(t\approx -3.57\), \(p\approx 0.0030\). There is strong evidence that the mean fill is below 500 g.
Example 3 A gardener grows 8 plants with fertiliser A and 9 with fertiliser B. Final heights (cm): A: 12.1, 13.4, 11.8, 12.9, 13.0, 12.4, 13.2, 12.6. B: 13.5, 14.1, 12.8, 13.9, 14.4, 13.1, 14.0, 13.6, 13.3. Assuming normal populations with equal variance, test at the 5% level whether B gives a greater mean height.
\(H_0:\mu_A=\mu_B\). \(H_1:\mu_A\lt\mu_B\).
From the GDC: \(\bar{x}_A=12.675\), \(s_A^2=0.305\), \(\bar{x}_B=13.633\), \(s_B^2=0.265\).
\(s_p^2=\frac{7\times 0.305+8\times 0.265}{8+9-2}=\frac{4.255}{15}\approx 0.2837\), so \(s_p\approx 0.5326\).
\(t=\frac{12.675-13.633}{0.5326\sqrt{\frac18+\frac19}}=\frac{-0.958}{0.2588}\approx -3.70\), with \(\nu=15\).
The two-sample pooled \(t\)-test feature with alternative "\(\lt\)" gives \(p\approx 0.00106\).
Since \(0.00106\lt 0.05\), reject \(H_0\).
Answer: \(t\approx -3.70\), \(p\approx 0.0011\). There is evidence that fertiliser B gives a greater mean height.
Common errors
- Using the divisor \(n\) standard deviation from the GDC instead of \(s_{n-1}\) in a confidence interval or \(t\)-test.
- Using the wrong degrees of freedom: \(n-1\) for one sample, \(n_1+n_2-2\) for the pooled two-sample test.
- Interpreting a 95% interval as "95% of the data lie in it" or "there is a 95% probability that \(\mu\) is in this interval".
- Choosing a two-tailed alternative when the question asks about an increase or decrease (or the reverse). Read the wording for the direction.
- Forgetting to state the assumptions (normal populations, and equal variances for the pooled test) or to write the conclusion in context.
Exam tip: Write the hypotheses in terms of \(\mu\), say which tail you use and why, then quote \(t\), \(\nu\) and the \(p\)-value. Finish with a sentence about the context, such as "the mean fill is below 500 g".
Check yourself
- The sample 4, 7, 9, 10, 15 comes from a population. Find unbiased estimates of the population mean and variance.
Answer
\(\bar{x}=\frac{45}{5}=9\). \(\sum(x-\bar{x})^2=25+4+0+1+36=66\), so \(s_{n-1}^2=\frac{66}{4}=16.5\). - A sample of 20 has mean 8.4 and \(s_{n-1}=1.1\). Find a 99% confidence interval for \(\mu\).
Answer
\(\nu=19\) and \(t=2.861\) (area 0.995). Margin \(=2.861\times\frac{1.1}{\sqrt{20}}\approx 0.704\). The interval is (7.70, 9.10). - A sample of 15 has mean 52.3 and \(s_{n-1}=4.8\). Test \(H_0:\mu=50\) against \(H_1:\mu\neq 50\) at the 5% level.
Answer
\(t=\frac{2.3}{4.8/\sqrt{15}}\approx 1.856\), \(\nu=14\). The two-tailed \(p\)-value is about 0.0847, which is greater than 0.05, so do not reject \(H_0\). (The critical value is 2.145.) - Two independent samples have sizes 8 and 9. How many degrees of freedom does the pooled \(t\)-test use, and what is the extra assumption compared with a one-sample test?
Answer
\(\nu=8+9-2=15\). The two populations must have equal variances.