Statistics · AP Statistics
Inference for means
t procedures for μ
A sample mean is a good estimate of a population mean, but only an estimate. Inference for means says how good, using nothing but the sample.
The figure is a simulation, so for once the truth is known: a population with mean μ = 250 and standard deviation 5. Again and again a random sample of 10 is drawn, and from each sample alone an interval is built, x̄ ± t*·s/√n.
The intervals move about with their samples. 19 of these 20 capture μ; the one that misses is red. In the long run 95% of them capture it, and that is what “95% confident” means.
This chapter: why t and not z (7.1); confidence intervals and significance tests for one mean (7.2–7.5), including paired data; the same for the difference of two means (7.6–7.9); and how to choose a procedure (7.10).
should I worry about error?
To standardize x̄ we need σ, which we almost never know. Putting the sample’s s in its place gives a statistic that varies more than z: it has a t distribution.
For a random sample, x̄ has mean μ and standard deviation σ/√n. With s for σ, the standard error of x̄ is s/√n, and
s changes from sample to sample too, and in a small sample it is often too small, so t lands far from 0 more often than z would. A t distribution is centred at 0, symmetric and bell-shaped, with heavier tails than the standard normal. Its degrees of freedom set its shape: as df grows, s pins down σ better and the curve approaches the normal.
| df | 2 | 5 | 10 | 15 | 30 | 100 | ∞ (z) |
| t* for 95% | 4.303 | 2.571 | 2.228 | 2.131 | 2.042 | 1.984 | 1.960 |
In the figure: with df = 4, P(|t| > 2) = 0.116, against 0.046 for z. Use z* = 1.96 with a small sample and the intervals come out too narrow: they capture μ less often than they claim. t* corrects that.
Error is always possible. An interval may miss μ; a test may reject a true null hypothesis (a Type I error) or fail to reject a false one (Type II). The methods say how often, never whether this time.
statistic ± (critical value)(standard error)
A one-sample t interval estimates a population mean μ from one random sample.
A coffee machine is set to pour 250 mL. A random sample of 16 cups (mL):
| 244.3 | 248.9 | 253.8 | 247.8 | 246.1 | 248.6 | 247.2 | 243.3 |
| 250.6 | 248.3 | 245.3 | 243.7 | 254.8 | 251.9 | 243.4 | 245.6 |
x̄ = 247.73 mL, s = 3.60 mL. With df = 15, t* = 2.131 for 95% confidence.
In the figure the blue ball is x̄, the dark rod one standard error each way, the red rod the whole interval: t* standard errors each way.
Interpret it in context: we are 95% confident that the interval from 245.81 to 249.64 mL captures the true mean volume of all cups this machine pours.
The margin of error, t*·s/√n, grows with the confidence level (90%: ±1.58; 99%: ±2.65) and shrinks as n grows, like 1/√n: four times the sample, half the margin.
random, 10%, and normal or large sample
A t interval or test is only trustworthy when three conditions hold. State each, in context, before computing.
Random. The data come from a random sample or a randomized experiment.
10%. When sampling without replacement, n ≤ 10% of the population, so the observations are close to independent.
Normal/Large sample. The population is approximately normal, or n ≥ 30. If n < 30 and the population’s shape is unknown, graph the sample: there must be no strong skew and no outliers.
The figure has three samples on one scale.
| n | the sample | Normal/Large? |
| A | 12 | roughly symmetric, no outliers | yes |
| B | 12 | strongly skewed right, 1 outlier | no |
| C | 40 | skewed right | yes, n ≥ 30 |
In B, Q1 = 2.40 and Q3 = 6.15, so anything above 6.15 + 1.5(3.75) = 11.78 is an outlier: 13.7 is. With only 12 values, x̄ and s are pulled by it, and the t procedure is not safe. C is skewed too, but with 40 values the central limit theorem makes the sampling distribution of x̄ close to normal.
For the coffee cups, 16 < 30, but their dotplot shows no strong skew or outliers, so the interval of 7.2 stands.
the plausible values of μ
A confidence interval gives the plausible values of μ. A claimed value outside it is not plausible; one inside it is plausible, but not proven.
The machine’s maker claims it pours 250 mL on average. The 95% interval, 245.81 to 249.64 mL, does not contain 250 (the blue line). Every plausible value is below it: the interval gives convincing evidence that the machine pours less than 250 mL on average.
At 99% confidence the interval is 245.07 to 250.38 mL. That does contain 250, so at this level the claim is plausible. More confidence means a wider interval, and fewer values ruled out.
What “95% confident” means. The method captures μ in 95% of all possible random samples, as in the opening figure. This one interval either captures μ or not; we don’t know which.
Common mistakes.
- “There is a 95% probability that μ is between 245.81 and 249.64.” No: μ is fixed; the probability belongs to the method.
- “95% of cups hold between 245.81 and 249.64 mL.” No: the interval is for the mean, not for single cups, which vary far more.
- “250 is in the 99% interval, so the mean is 250.” No: it is only one of many plausible values.
hypotheses about a population mean
A one-sample t test asks whether a sample gives convincing evidence against a claimed value μ0 of a population mean.
A quality inspector checks whether the machine is off target, in either direction:
where μ is the true mean volume, in mL, of all cups the machine pours. Hypotheses are about the parameter μ, never about x̄, and they are chosen before looking at the data. If only underfilling mattered, Ha: μ < 250 would be one-sided.
The significance level, α = 0.05, is chosen in advance too: it is the probability of a Type I error, rejecting H0 when it is true.
The conditions are those for an interval: a random sample; 16 cups less than 10% of all cups poured; no strong skew or outliers in the sample, since 16 < 30.
The question the test answers: the sample mean, 247.73 mL (blue), is below 250. Is it far enough below, counted in standard errors, that chance alone is an unlikely explanation?
the t statistic and its p-value
The test statistic counts how many standard errors x̄ is from μ0. The p-value is the chance of a result at least that extreme if H0 were true.
For Ha: μ ≠ 250 both tails count (red): p-value = 2P(t ≤ −2.53) = 0.023.
Conclude in context. Because 0.023 < α = 0.05, we reject H0. There is convincing evidence that the true mean volume of all cups this machine pours is not 250 mL.
Interpret the p-value: assuming the true mean is 250 mL, there is a 0.023 probability of getting a sample mean at least as far from 250 as 247.73 mL, in either direction, by chance alone in a random sample of 16 cups.
The test agrees with the 95% interval of 7.3, which left 250 out: a two-sided test at α = 0.05 rejects exactly the values a 95% interval leaves out. At α = 0.01 we would not reject, as 250 sits in the 99% interval.
Failing to reject never shows H0 is true; it only says the evidence is not convincing.
one sample of differences
When each individual is measured twice, or the individuals come in matched pairs, analyse the differences: they are one sample, and the one-sample t procedures apply to them.
12 randomly chosen students take a reading-speed test (words per minute) before and after a short course. In the figure each student is a rod joining before (grey) to after (black). The rods slide over to start at 0, and their lengths are the differences d = after − before:
| before | 208 | 135 | 209 | 170 | 169 | 245 | 195 | 160 | 230 | 207 | 212 | 195 |
| after | 213 | 133 | 229 | 183 | 177 | 260 | 203 | 171 | 226 | 231 | 223 | 205 |
| d | 5 | −2 | 20 | 13 | 8 | 15 | 8 | 11 | −4 | 24 | 11 | 10 |
x̄d = 9.92, sd = 8.01. Test H0: μd = 0 against Ha: μd > 0, where μd is the true mean gain for students like these.
p-value = 0.0006: convincing evidence that the course raises mean reading speed. The 95% interval for μd is 4.83 to 15.00 words per minute (red).
The conditions are checked on the differences: a random sample, 12 < 10% of all such students, and, as 12 < 30, a dotplot of the differences with no strong skew or outliers.
two independent samples
To compare the means of two populations (or two treatments), use the two-sample t interval for μ1 − μ2.
A reviewer tests random samples of two brands of battery in the same torch (hours of light):
| n | x̄ (h) | s (h) |
| brand A | 14 | 11.94 | 1.27 |
| brand B | 12 | 10.68 | 1.07 |
Degrees of freedom. Technology uses a formula that gives here df = 24.0, so t* = 2.064. Without it, the conservative choice is the smaller n − 1 = 11, t* = 2.201: a slightly wider interval, (0.25, 2.27). Say which one you used.
Conditions: two independent random samples (or two groups formed by random assignment); each n ≤ 10% of its population; each n ≥ 30, or neither sample shows strong skew or outliers.
Interpret: we are 95% confident that the interval from 0.31 to 2.21 hours captures the true difference in mean battery life, brand A minus brand B.
where does 0 fall?
For a difference of means, the value to look for is usually 0: no difference. If 0 is outside the interval, the interval gives convincing evidence of a difference.
Claim 1: brand A lasts longer on average. Every value in 0.31 to 2.21 hours is positive, so 0 is not plausible: there is convincing evidence that μA − μB > 0, that brand A lasts longer on average.
Claim 2: brand A lasts at least 2 hours longer on average. 2 is inside the interval, so it is plausible, but so are values well below it, down to 0.31. The interval does not give convincing evidence for this claim (nor against it).
Read the sign with the order of subtraction. A − B from 0.31 to 2.21 is the same statement as B − A from −2.21 to −0.31.
The conclusion is about the means of the populations sampled. Had the data come from a randomized experiment, it would also be about cause and effect; from random samples it is not.
paired or two-sample?
First decide how the data were produced. Two measurements on each individual, or matched pairs, call for a paired t test on the differences; two independent groups call for a two-sample t test.
For two independent groups:
defining μ1 and μ2 in context and saying which is subtracted from which. For pairs, the parameter is the single mean difference μd.
Why it matters. The reading speeds of 7.5, wrongly treated as two independent samples:
| SE | t | p-value |
| paired (right) | 2.31 | 4.29 | 0.0006 |
| two-sample (wrong) | 13.30 | 0.75 | 0.232 |
Same means, same difference 9.92. But the students differ from one another far more (s ≈ 31 words per minute) than any one student changes (sd = 8.01). The two-sample analysis counts all that student-to-student spread as noise; pairing removes it. In the figure the blue interval is the wrong analysis, the red one the right.
The two-sample procedure also needs the groups to be independent, and before and after scores of one student are not.
the two-sample t test
The test statistic is the difference of the sample means, less its value under H0, counted in standard errors.
The reviewer of 7.6 asked in advance whether brand A lasts longer. H0: μA − μB = 0, Ha: μA − μB > 0, where each μ is the true mean life of that brand in this torch, at α = 0.05.
With df = 24.0 (technology), the p-value is P(t ≥ 2.74) = 0.0057, the red tail (magnified in the corner); with the conservative df = 11 it is 0.0096. Either way it is less than 0.05.
Conclude: reject H0. There is convincing evidence that brand A batteries last longer on average than brand B in this torch.
Don’t pool the two standard deviations: the AP course uses the unpooled standard error above. And don’t run two one-sample tests and compare them: the question is about the difference, so the procedure must be.
selecting, carrying out and communicating
Most of the work is in the choice. Ask, in order: what kind of parameter, how many samples, and estimate or test?
Mean or proportion? Quantitative data (a measurement for each individual) lead to a mean μ and t. Categorical data (yes or no) lead to a proportion p and z (Chapter 6). Means use t because σ is estimated by s.
One sample, paired, or two samples? Paired data are one sample of differences. Two independent samples, or two treatment groups, use the two-sample procedures.
Interval or test? “Estimate” or “how much” asks for an interval; “is there convincing evidence” asks for a test.
| procedure | standard error | df |
| one-sample t | s/√n | n − 1 |
| paired t | sd/√n | n − 1 (pairs) |
| two-sample t | √(s12/n1 + s22/n2) | technology, or smaller n − 1 |
Then communicate, in four steps: State the parameter and hypotheses (or confidence level) in context; Plan: name the procedure and check random, 10% and normal/large sample; Do: the statistic, df and p-value or interval; Conclude in context, linked to α, without claiming more than the design allows.
← Inference for proportions · Chi-square tests →