With few data, the mean over its estimated spread does not follow the bell. Watch its curve’s tails shrink as the sample grows.
Small samples, heavier tails
The t curve against the standard bell, and how much of each lies beyond ±2.
1 degree of freedom: 0.2952 of the t curve lies beyond ±2, against 0.0455 for the bell. Its tails are so heavy that the 95 % critical value is 12.71.
Describe this picture
One axis from −6 to 6 with two curves: the standard bell, dashed, and the t curve for a given number of degrees of freedom, solid and labelled with them. The area of the t curve beyond −2 and 2 is shaded, and a readout gives it, beside the bell’s 0.0455 and the 95 % critical value. In the clip, over 8 seconds, the degrees of freedom step through 1, 2, 3, 5, 10 and 30, each change a short morph: the t curve starts as a low hump with wide tails and closes onto the bell. The shaded share reads 0.2952, 0.1835, 0.1393, 0.1019, 0.0734 and 0.0546, against 0.0455 for the bell, and the critical value falls from 12.71 to 2.04. Then the curve returns to 2 degrees of freedom, where the slider starts. After the clip a slider, “Degrees of freedom”, sets them from 1 to 30.
The t law
In Confidence intervals, putting the sample standard deviation in place of the true one forced a wider edge than 1.96. Here is the curve behind that.
Draw values from a bell with mean , and form
with the sample standard deviation, the random version of . Here is the spread of the draws, not the sample space of What probability measures. For bell-shaped data, follows the t law with degrees of freedom, written . Its curve is a bell with heavier tails. With 2 degrees of freedom, 18.35 % of its area lies beyond ; the bell has only 4.55 % there. As the sample grows the t curve closes onto the bell.
The 95 % edge, , falls with the degrees of freedom, from 12.71 at 1 to 1.96 in the limit.
Why the tails are heavier
The bottom of is random too. When a small sample happens to bunch together, its is small, and dividing by a small number throws far out.
Why the tails are heavier
5000 samples of 3 from a bell, each turned into T = mean/(s/√3) (seed 8300).
Draw 3 values from a bell with mean 0. Divide their mean by its estimated standard error, s/√3: that is T.
Predict first. How often will T land beyond ±2?
Describe this picture
Three panels that stay apart. The first, “the population”, is a bell. The second, “one sample”, shows 3 values drawn from it as dots, with a line at their mean and a bar for their spread . The third, “the statistic T”, is a histogram of the values of (seed 8300) on an axis from −6 to 6, with the bell, dashed, and the t curve for 2 degrees of freedom drawn over it; the stretches beyond ±2 are lightly shaded. Before the clip a question asks how often lands beyond : about 5 %, about 18 %, or about 30 %. A tap picks one and starts the clip. In the clip ten samples are drawn one by one, each dropping its into the histogram, then the other 4990 pour in; samples whose three values bunch together have a small and send far out, like the seventh, . Readouts count the samples and the values beyond : 902 of 5000, 18.0 %. There is no control after the clip.
Before the clip you guessed. About 18 % of the values land beyond , as the t curve says, not 5 % as the bell would. Of 5000, expect about 918; the clip’s run gave 902.
Watch out
The mean over its estimated standard error is close to a standard bell only for large samples. For small ones, use the t curve: the bell’s 1.96 gives intervals that are too narrow and tests that cry wolf too often.
The one-sample test
To test whether a mean is , compute and read the two-sided from the t law with degrees of freedom.
The eight response times of Describing data have ms and ms. Is their mean 15 ms, the target? The standard error is , so with 7 degrees of freedom, and : too little evidence to reject 15.
The 95 % interval of Confidence intervals for the same data, 13.81 to 18.69 ms, contains 15. That is the same statement. A 95 % interval holds exactly the values that a two-sided 5 % test would not reject.
Two samples
The two page layouts of p-values gave old times 10, 11, 12, 16 and new times 14, 15, 17, 19. Their means are 12.25 and 16.25, and their sample variances and .
Pooled. If both groups share one spread, combine their variances, weighted by their degrees of freedom: . The standard error of the difference is , so with degrees of freedom, and two-sided .
Welch. If the spreads may differ, use each group’s own variance, , and a reduced number of degrees of freedom. With equal group sizes the standard error is the same here; the degrees of freedom fall to , and . Welch’s version is the safer default.
The exact shuffle test gave for the same data. With four values per group, the t law and the shuffle disagree in the second digit: small samples make every method rough.
Pairs
Five people were timed before and after a change: before 20, 24, 18, 22, 26, after 23, 25, 22, 24, 31. Each person was measured twice, so look at each person’s difference: 3, 1, 4, 2, 5. Their mean is 3 and their is 1.5811, so the standard error is 0.7071 and with 4 degrees of freedom: .
Treat the same numbers as two unrelated groups and the answer changes. The means are 22 and 25, the variances 10 and 12.5, the pooled variance 11.25, and the standard error : with 8 degrees of freedom, .
The people differ from each other far more than the change moves any one of them. Pairing takes those differences between people away, and the effect shows. A paired test is a one-sample test on the differences.
What the test assumes
- Independence. The values must not influence each other. This matters most and cannot be fixed afterwards.
- A rough bell. For tiny samples the data should be roughly bell-shaped. For larger samples The central limit theorem makes the mean close to a bell anyway, and the test holds up.
- No wild values. One outlier changes both the mean and , as in Describing data; look at the data first.
Worked example
1. The response times against 15 ms. , 7 degrees of freedom, . At the 5 % level, is below the edge : not rejected.
2. The layouts. Pooled: , 6 degrees of freedom, . Welch: 5.83 degrees of freedom, .
3. Before and after. Paired: . Unpaired: .
4. The 95 % edges.
| Degrees of freedom | 1 | 2 | 3 | 4 | 5 | 7 | 10 | 30 | unlimited |
|---|---|---|---|---|---|---|---|---|---|
| Edge | 12.706 | 4.303 | 3.182 | 2.776 | 2.571 | 2.365 | 2.228 | 2.042 | 1.960 |
Try it yourself. For the same , the is larger with 3 degrees of freedom than with 30: the tails are heavier. As the sample grows without limit, the t curve becomes the bell.
Where you’ll meet this
Small comparisons. Comparing two versions of a product on a handful of units, or two lab methods on a few samples, is a two-sample t-test.
Measurement against a standard. Checking whether an instrument’s mean reading matches a reference value is a one-sample t-test.
Before and after. Studies that measure the same people, machines or sites twice use paired tests, and gain a great deal from it.
In signal processing · standard error and testing
Averaging EEG trials and asking whether a response at 300 ms differs from zero is a t-test across trials, with the trials’ scatter as . EEG and rhythms in the signal processing course uses it.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| t statistic | follows for bell-shaped data | |
| Heavier tails | beyond : 0.2952, 0.1835 at 1, 2 degrees of freedom | the bell: 0.0455 |
| One sample | , degrees of freedom | matches the t interval |
| Pooled two-sample | , SE | degrees of freedom |
| Welch | SE | the safer default |
| Paired | one-sample test on the differences | removes unit-to-unit spread |
| Assumes | independence; a rough bell for tiny ; no wild values |