Sampling, estimation and hypothesis testing
A-Level Mathematics · Probability & Statistics — Further
Sampling and the Central Limit Theorem
For a random sample of size $n$ from a population with mean $\mu$ and variance $\sigma^{2}$:
$$\text{E}\left(\bar X\right)=\mu,\qquad \text{Var}\left(\bar X\right)=\frac{\sigma^{2}}{n}$$The Central Limit Theorem says that for large $n$, $\bar X$ is approximately normal whatever the population distribution. This is what makes inference possible without knowing the population shape.
Unbiased estimates
$$\hat\mu=\bar x=\frac{\sum x}{n},\qquad s^{2}=\frac{1}{n-1}\left(\sum x^{2}-\frac{\left(\sum x\right)^{2}}{n}\right)$$The divisor is $n-1$, not $n$: dividing by $n$ systematically underestimates the spread.
Confidence intervals
$$\bar x\pm z\frac{\sigma}{\sqrt{n}}\qquad(z=1.96\ \text{for}\ 95\%,\ 2.576\ \text{for}\ 99\%)$$Hypothesis tests
- state $H_{0}$ and $H_{1}$ in terms of a population parameter;
- compare the $p$-value with the significance level, or the test statistic with the critical value;
- conclude in context, and never claim to have proved anything;
- a Type I error is rejecting a true $H_{0}$; a Type II error is failing to reject a false $H_{0}$.
Worked example: confidence interval and how to read it
A random sample of $100$ components has a mean lifetime of $25.0$ hours. The population standard deviation is known to be $\sigma=5$ hours. Construct a $95\%$ confidence interval for the population mean $\mu$, and explain what it means.
Solution
Step 1 — standard error.
$$\frac{\sigma}{\sqrt{n}}=\frac{5}{\sqrt{100}}=0.5$$Step 2 — the interval.
$$25.0\pm 1.96(0.5)=25.0\pm 0.98$$$$(24.02,\ 25.98)$$Step 3 — interpret it correctly. The standard interpretation is: if this sampling procedure were repeated very many times, $95\%$ of the intervals obtained would contain $\mu$.
A very common incorrect statement: “there is a $95\%$ probability that $\mu$ lies in the interval $(24.02,\ 25.98)$”. It is wrong because $\mu$ is a fixed constant, not random — it either lies in that interval or it does not. What is random here is the interval, because it changes from sample to sample. Cambridge awards a separate mark for this interpretation, and it is the easiest mark to lose in the whole question.
Two practical remarks. Raising the level to $99\%$ increases $z$ to $2.576$, so the interval becomes wider — to be more certain you must be vaguer. Increasing $n$ to $400$ cuts the standard error in half, so the interval becomes half as wide; to halve the width you must pay four times the sample size.
Worked example: a test on a discrete variable and Type I error
The number of flaws per roll of fabric has always followed $\text{Po}(4)$. After a change in the process, one roll is inspected and found to have $1$ flaw. Test at the $5\%$ level whether the mean number of flaws has decreased, then find the rejection region and the probability of a Type I error.
Solution
Step 1 — hypotheses, written in terms of the population parameter.
$$H_{0}:\ \lambda=4\qquad H_{1}:\ \lambda<4$$Step 2 — calculate $p$. This is a one-tailed test on the left, so $p$ is the probability of observing a result equal to or more extreme than the value seen:
$$p=P(X\le 1\mid \lambda=4)=e^{-4}(1+4)=5(0.018316)=0.0916$$Step 3 — compare and conclude. $0.0916>0.05$, so do not reject $H_{0}$. There is not enough evidence at the $5\%$ level to conclude that the mean number of flaws per roll has decreased.
Step 4 — rejection region. Because $X$ takes integer values, you must check each value in turn:
$$P(X\le 0)=e^{-4}=0.0183<0.05\qquad P(X\le 1)=0.0916>0.05$$So the rejection region consists only of $X=0$.
Step 5 — Type I error. This is the probability of falling in the rejection region when $H_{0}$ is true:
$$P(\text{Type I})=P(X=0\mid\lambda=4)=0.0183$$Notice that this figure is smaller than the $5\%$ significance level, and that is not a mistake: with a discrete variable the rejection region jumps in integer steps, so it rarely matches exactly $5\%$. Getting a figure larger than $0.05$ is the sign that the wrong rejection region was chosen.