In this article
Before you start
This page is one question from the statistics interview guide for machine learning and data roles. The related procedure is covered in what a t-test is and how to run one.
Why interviewers ask this
The question separates candidates who can recite a formula from those who know what problem the formula solves. Any test or confidence interval for a mean needs a measure of spread, and the honest follow-up is where that spread comes from.
A weak answer says "use t when the sample is small" and stops. A strong answer says the true standard deviation is unknown, so the sample's estimate replaces it, and the extra noise in that estimate means the cutoffs must be wider. A Staff-level answer adds the assumptions (roughly normal data or enough observations), what happens as the sample grows, and where the same ratio appears in regression and in A/B testing.
The t-statistic from first principles
- t-statistic
- A t-statistic is a test statistic that measures how many estimated standard errors a sample mean sits from a hypothesized mean, using the sample's own standard deviation instead of the unknown population value, so that its spread follows a t-distribution rather than a normal curve.
In plain words
Imagine checking whether a parcel's weight matches its label. A scale with a known error would let you say "this reading is far too off." Now suppose you had to guess the scale's error from only a few earlier readings. You would sensibly accept a wider range before shouting "mismatch". Your guess of the error is itself shaky. The analogy breaks in one place: the t-distribution gives the exact size of that extra caution, not a vague feeling.
In one precise sentence, the t-statistic is the usual z-style ratio with the unknown standard deviation replaced by the sample's estimate, and the t-distribution is the correction for that replacement (Student, 1908).
Step 1: A z-statistic needs a standard deviation you do not have
To ask whether a sample mean is far from a target mean , you scale the gap by how much sample means normally wobble. If the population standard deviation were known, that wobble is and the ratio is the z-statistic:
Here is the sample mean and is the number of observations. With a known , this ratio follows the standard normal curve when the data are normal, so cutoffs such as 1.96 are fixed (the "Normal Values" row of the NIST critical-values table lists 1.960). Everywhere else, you hold only the sample, and the denominator cannot be computed. You now know the obstacle; the next step removes it.
Step 2: Replace sigma with the sample's own estimate
The fix is to compute the sample standard deviation from the same data and use it in place of :
The denominator is the estimated standard error. Take an illustrative sample of ten values with a mean of 50.5, an of 3.03 and therefore a standard error of 0.96.1 To test a hypothesized mean of 48.5, the gap is 2.0, so the t-statistic is 2.09.1 Input: ten numbers and a target. Output: one ratio. The catch is that changes from sample to sample, so the ratio is noisier than the z version. How much noisier is the next step.
Step 3: Heavier tails widen the cutoff, and sample size is not the reason
The result is compared with a t distribution with n minus one degrees of freedom. Because is itself random, small values inflate the ratio now and then, so extreme values occur more often than under the normal curve. That is what "heavier tails" means. The cutoff for a two-sided ninety-five percent interval is therefore larger than 1.96: it is 2.776 with four degrees of freedom and 2.262 with nine.1 As degrees of freedom grow, the t-distribution approaches the standard normal (NIST handbook, critical values of the t distribution), and the cutoff falls toward 1.960.1
So the answer to "only for small samples?" is no. The reason for t is the unknown , at any . Large samples merely make the penalty small: at ninety-nine degrees of freedom the cutoff is 1.984, close to 1.96.1 For normally distributed data, a z-style interval built with covers the truth about 88% of the time at five observations, 92% at ten and 94% at thirty, instead of the promised 95%.1
Step-by-step description
- Only the sample is available.
- Divide the gap by s over root n.
- Judge it against the t-distribution.
- The denominator is the estimated standard error.
- The result is compared with a t distribution with n minus one degrees of freedom.
Worked example: the same ten values with t and z
| Degrees of freedom | 95% two-sided cutoff | Coverage if 1.96 is used with s |
|---|---|---|
| 4 | 2.776 | 88% |
| 9 | 2.262 | 92% |
| 29 | 2.045 | 94% |
| 99 | 1.984 | about 95% |
| Normal curve | 1.960 | 95% |
Text description of the diagram
- At nine degrees of freedom the ninety-five percent cutoff is 2.262, and it falls toward 1.960 as degrees of freedom grow.
- The cutoff is 2.776 at four degrees of freedom and 1.960 for the normal curve.
The ten values give a t interval of 48.33 to 52.67 (cutoff 2.262 at nine degrees of freedom) and a z-style interval of 48.62 to 52.38 (cutoff 1.96).1 The hypothesized 48.5 sits inside the first and outside the second, so using 1.96 with s would wrongly reject it; the t-statistic of 2.09 falls between 1.96 and 2.262.1 The NIST handbook on confidence limits for the mean gives this t interval.
Knowing it is half the job. Saying it is the other half.
Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.
Start Free Trial →The Staff-level answer
Why would you use a t-statistic instead of a z-statistic?
The z-statistic divides by the population standard deviation, which I almost never know. So I plug in the sample standard deviation, and the ratio becomes a t-statistic. Because that estimate is noisy, the ratio has heavier tails than a normal, and I compare it with a t-distribution with n minus one degrees of freedom. At small n that gives wider intervals and avoids overstating confidence. At large n the two agree closely. It assumes roughly normal data, or enough observations that the mean is close to normal, so I check for outliers first.
What makes it Staff-level: it names the unknown, says what breaks if you ignore it (overstated confidence), states the assumption, and says the gap vanishes as the sample grows rather than citing a size cutoff.
The rubric
| Dimension | Weak answer | Strong answer | Staff answer |
|---|---|---|---|
| Correctness | "Use t for small samples." | Use t because the population standard deviation is unknown. | Also says it is needed at any n, with the penalty fading as n grows. |
| Depth | Quotes the formula only. | Explains that s replaces sigma and adds uncertainty. | Explains heavier tails and degrees of freedom. |
| Trade-offs | No mention of wider intervals. | Says cutoffs are larger at small n. | Quantifies undercoverage if z is used with s. |
| Assumptions | Silent. | Mentions roughly normal data. | Mentions large-n approximation and outlier checks. |
| Communication | Rambles. | Answers in three sentences. | Leads with the unknown, then the consequence. |
Three variants of this question
Why use a t-statistic instead of a z-statistic?
Use the z-statistic only when the population standard deviation is genuinely known. Otherwise the t-statistic is the honest version, because it prices in the uncertainty of estimating that spread from the sample.
Why does the t-distribution have fatter tails than the normal?
Because the denominator is random. Occasionally a sample has an unusually small , which pushes the ratio far out, so large values are more likely than under a normal curve. More data steadies and the tails thin.
When would you still use a z-statistic?
When the population standard deviation is known from outside the sample, or when you are working with proportions and large counts where a normal approximation is standard. With a mean and an estimated spread, the t-statistic is the default.
Common mistakes
- "Use t only when n is under thirty." (wrong) The cutoff is a rule of thumb, not the reason. (right) "Use t whenever sigma is unknown; the difference shrinks as n grows."
- "The t-statistic makes the data normal." (wrong) It transforms nothing. (right) "It assumes roughly normal data, or enough observations for the mean to be near normal."
- "The t-statistic and the t-test are the same thing." (wrong) One is a number, the other a procedure. (right) "The t-statistic is the quantity; the t-test compares it with the t-distribution."
- "A bigger t means a bigger effect." (wrong) It also grows with n. (right) "It measures the gap in standard errors, so report the effect size and an interval too."
Follow-up questions
What are degrees of freedom in a t-statistic?
Degrees of freedom in a one-sample t-statistic are the number of observations minus one, because the deviations from the sample mean must sum to zero, so only that many are free. They choose which t-distribution to use.
What if the data are not normal?
The exact t-distribution result assumes normal data. With enough observations the sample mean is close to normal anyway, thanks to the central limit theorem, but heavy outliers or strong skew can still mislead, so check the data and consider the mean versus median question. The t-test is fairly robust to mild non-normality; for strong skew, a bootstrap interval (as the NIST page notes) or a rank test is the alternative.
How is the t-statistic different from the t-test?
The t-statistic is the computed ratio. The t-test is the procedure that compares that ratio with the t-distribution to produce a p-value or decision.
Where does the t-statistic show up in machine learning?
The t-statistic shows up wherever an estimate is divided by its estimated standard error, such as a regression coefficient's significance or the comparison of two variants in an experiment. For two groups with unequal spreads, Welch's t-test, a version that does not pool the two variances, is the usual choice. More practice sits in the probability interview questions.
- Use a t-statistic because the population standard deviation is unknown, not because the sample is small.
- It replaces sigma with the sample's s, so the denominator is the estimated standard error.
- The extra uncertainty gives heavier tails, wider cutoffs and n minus one degrees of freedom.
- As the sample grows, t and z converge; at small n, using z overstates confidence.
- It assumes roughly normal data or enough observations for the mean to be near normal.
Sources
- The Probable Error of a Mean (Student, Biometrika 6(1)) — Biometrika (Student, W. S. Gosset), 1 Mar 1908
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.2 Confidence Limits for the Mean — NIST, 26 Oct 2026
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.6.7.2 Critical Values of the Student's t Distribution — NIST, 26 Oct 2026