Confidence Intervals and Test Assumptions › Choosing Between Z-Tests and T-Tests
Machine Learning from ScratchAll chapters Confidence Intervals and Test Assumptions › Choosing Between Z-Tests and T-TestsOne section · Sections in this chapter5 / 9 ↓
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
The choice between z-tests and t-tests depends on whether you know the population standard deviation.
The Z-Test: Known Variance
The z-test assumes you know the population standard deviation :
Under , this follows a standard normal distribution .
When do you know ? Rarely. Possible scenarios include:
- Measurement instruments with known precision from extensive calibration
- Standardized tests with established population parameters
- Very large historical datasets that effectively reveal the population
The T-Test: Unknown Variance
The t-test estimates from the sample using :
Under , this follows a t-distribution with degrees of freedom.
Why the t-distribution? When you estimate with , you introduce additional uncertainty. The sample standard deviation is itself a random variable. The t-distribution has heavier tails than the normal to account for this uncertainty.
The T-Distribution: Heavy Tails for Small Samples

The practical consequence: t-tests give larger p-values (and wider confidence intervals) than z-tests for the same data. This is appropriate because we're less certain when we don't know .
| Degrees of Freedom | t Critical Value (95% CI) | Compared to z = 1.96 |
|---|---|---|
| 5 | 2.571 | 31% larger |
| 10 | 2.228 | 14% larger |
| 20 | 2.086 | 6% larger |
| 30 | 2.042 | 4% larger |
| 100 | 1.984 | 1% larger |
| ∞ | 1.960 | Same as z |
For practical purposes, with n > 30, the difference between t and z is usually negligible. But always use the t-test when is unknown. There's no benefit to using z without a known , and it can inflate your Type I error rate for small samples.