The T-Test › The Student's T-Distribution
Machine Learning from ScratchAll chapters The T-Test › The Student's T-DistributionOne section · Sections in this chapter3 / 11 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Mathematical Foundation
When we replace with , the test statistic becomes:
This ratio follows a t-distribution with degrees of freedom (df). The degrees of freedom represent the amount of independent information available to estimate the variance. When computing from observations, we use up one degree of freedom estimating the mean, leaving degrees of freedom for estimating variance.
The t-distribution has several key properties:
- Bell-shaped and symmetric: Like the normal distribution, centered at zero under the null hypothesis
- Heavier tails: More probability in the extreme values than the normal distribution
- Parameterized by degrees of freedom: The shape depends on df, with smaller df meaning heavier tails
- Converges to normal: As , the t-distribution approaches the standard normal
The heavier tails account for the uncertainty added by estimating variance: with small samples, can deviate substantially from , so extreme t-values become more probable. The t-distribution therefore requires larger critical values to reject the null hypothesis.
Why Heavier Tails Make Sense
Consider what happens when happens to underestimate :
- The denominator is too small
- The t-statistic is inflated
- We might incorrectly reject
When overestimates :
- The denominator is too large
- The t-statistic is deflated
- We might miss a real effect
These errors don't favor either direction on average, but they add variability. The t-distribution captures exactly this additional spread. With only 5 observations (df = 4), the sample standard deviation is quite unreliable, so the t-distribution has very heavy tails. With 100 observations (df = 99), is a much more reliable estimate of , and the t-distribution is nearly identical to the normal.

Critical Values: The Practical Impact
The heavier tails translate directly into larger critical values. For a two-sided test at :
| Degrees of Freedom | t-critical | z-critical |
|---|---|---|
| 5 | 2.571 | 1.960 |
| 10 | 2.228 | 1.960 |
| 20 | 2.086 | 1.960 |
| 30 | 2.042 | 1.960 |
| 100 | 1.984 | 1.960 |
| 1.960 | 1.960 |
With df = 5, you need a t-statistic 31% larger than the z-critical value to reject . This penalty appropriately reflects the unreliability of variance estimates from small samples. By df = 30, the difference is only about 4%, which is why older textbooks sometimes said "use z for n > 30." Modern practice uses the t-distribution regardless, as computational tools make it trivially easy.
