A t-test answers one of the most common questions in applied statistics: is this difference between groups real, or could it plausibly be explained by chance alone? Does a new teaching method actually improve test scores, or did this particular class just happen to do a bit better? The t-test is the standard tool for comparing means when your sample size is modest and the true population standard deviation is unknown β which describes the overwhelming majority of real research.
- The three types of t-test, and exactly when to use each one
- Why the t-distribution is used instead of the normal distribution
- A full worked example of an independent two-sample t-test
- How to check the assumptions a t-test relies on
Why the T-Distribution, Not the Normal Distribution?
The t-test extends the general hypothesis testing framework β null and alternative hypotheses, a significance level, a test statistic, a p-value, and a decision β to the specific, extremely common case of comparing means. Everything covered in that framework (Type I and Type II errors, one-tailed vs. two-tailed tests, the meaning of "fail to reject") applies directly here.
A z-test requires knowing the true population standard deviation, Ο β something rarely known in practice. When Ο must be estimated from the sample (using s), that estimate itself carries uncertainty, especially with small samples. The t-distribution accounts for this extra uncertainty with heavier tails than the normal distribution β meaning more probability sits further from the centre, which is exactly the right adjustment when your estimate of spread is itself imperfect. As sample size grows, the t-distribution converges toward the normal distribution, since a larger sample gives a more reliable estimate of s.
The Three Types of T-Test
- One-sample t-test: compares a single sample's mean against a known or hypothesized value. "Is this batch's average weight different from the target of 500g?"
- Independent (two-sample) t-test: compares the means of two separate, unrelated groups. "Do students taught with Method A score differently than students taught with Method B?"
- Paired t-test: compares two measurements taken on the same subjects, typically before and after some intervention. "Did blood pressure change after patients started a new medication?"
Using an independent t-test on paired data (or vice versa) is a genuine, common error that produces a wrong answer, not just a suboptimal one. If the same subjects appear in both groups being compared (before/after, matched pairs), the paired test is almost always correct β it accounts for the natural correlation between each subject's two measurements, which an independent test ignores, typically making the paired test more powerful at detecting a real effect.
One-Sample T-Test Formula
Here xΜ is the sample mean, ΞΌβ is the hypothesized population value, s is the sample standard deviation, and n is the sample size. The degrees of freedom for this test is n β 1.
Independent Two-Sample T-Test Formula
This version (Welch's t-test, which doesn't assume the two groups have equal variances β the more robust default choice) compares the difference between two independent sample means, scaled by the combined uncertainty from both samples.
Worked Example: Independent Two-Sample T-Test
Problem: Two teaching methods are compared. Group A (n=25) scores a mean of 78 with SD 8. Group B (n=25) scores a mean of 74 with SD 9. At Ξ± = 0.05, is there a significant difference?
Hypotheses: Hβ: ΞΌβ = ΞΌβ (no difference). Hβ: ΞΌβ β ΞΌβ (two-tailed).
Test statistic: t = (78 β 74) / β(8Β²/25 + 9Β²/25) = 4 / β(2.56 + 3.24) = 4 / β5.8 = 4 / 2.408 β 1.66
Degrees of freedom (Welch-Satterthwaite approximation): approximately 47 for this example.
P-value: for t β 1.66 with df β 47, two-tailed p β 0.103
Decision: p (0.103) > Ξ± (0.05) β fail to reject Hβ
Conclusion: There isn't statistically significant evidence, at the 5% level, that the two teaching methods produce different mean scores β despite Group A scoring 4 points higher on average, that difference is small enough relative to the natural variability within each group that it's plausibly explained by chance.
Worked Example: Paired T-Test
Problem: Ten patients' blood pressure is measured before and after starting a new medication. The differences (before β after) average 6 mmHg with a standard deviation of 5 mmHg. Is there evidence the medication reduces blood pressure?
Test statistic: t = dΜ / (s_d/βn) = 6 / (5/β10) = 6 / 1.581 β 3.79, with df = nβ1 = 9
P-value (one-tailed, since the research question specifically predicts a reduction): p β 0.002
Decision: p (0.002) < Ξ± (0.05) β reject Hβ. There's strong evidence the medication reduces blood pressure.
Assumptions Behind a T-Test
A t-test's results are only trustworthy when its underlying assumptions roughly hold:
- Independence: observations within each group must be independent of one another (not applicable across paired measurements, which are deliberately dependent by design).
- Approximate normality: the data (or, for larger samples, the sampling distribution of the mean via the Central Limit Theorem) should be roughly normally distributed. T-tests are reasonably robust to mild departures from normality, especially with larger samples, but severe skew or extreme outliers can distort results.
- Roughly similar variances (for the classic "pooled" two-sample t-test β Welch's version, used above, relaxes this requirement, which is why it's the more commonly recommended default today).
When these assumptions are seriously violated β heavily skewed data with a small sample, for instance β a non-parametric alternative like the Mann-Whitney U test may be more appropriate than a t-test.
Effect Size: What a P-Value Alone Doesn't Tell You
A significant t-test tells you a difference likely exists, but not how large or practically meaningful it is. Cohen's d β the standardized difference between two means, in units of pooled standard deviation β fills this gap: d = (xΜβ β xΜβ) / pooled SD. Conventionally, d β 0.2 is a small effect, 0.5 is medium, 0.8 is large. Reporting effect size alongside a p-value is increasingly standard practice, precisely because a large sample can make a trivially small difference statistically significant, and effect size is what tells you whether that difference actually matters.
Real-World Uses
Clinical trials: comparing a treatment group's outcomes against a control group is one of the most common applications of the independent two-sample t-test in medical research, though large trials increasingly use more sophisticated models that also adjust for other variables.
A/B testing: comparing average conversion value, time-on-page, or other continuous metrics between two website variants often uses a t-test as the underlying statistical engine, deciding whether an observed difference is likely to reflect a genuine difference in user behaviour rather than random noise in who happened to see which variant.
Manufacturing quality control: a one-sample t-test can check whether a batch of products' average measurement (weight, dimension, concentration) differs significantly from a target specification, flagging a process that may be drifting out of tolerance before it produces widespread defects.
Common Mistakes
Running a t-test on clearly non-normal data with a small sample. With a small sample and severely skewed or heavy-tailed data, the t-test's normality assumption can be seriously violated, and a non-parametric alternative should be considered instead.
Treating "not significant" as proof of no difference. A non-significant t-test with a small sample often reflects low statistical power to detect a real but modest effect, not solid evidence that no difference exists. Reporting a confidence interval for the difference alongside the p-value makes this distinction visible.
Ignoring the paired-vs-independent distinction. As covered above, this is a genuinely common error that produces an incorrect result, not just a less powerful one β always check whether your two groups of measurements come from the same subjects before choosing a test.
When should I use a t-test instead of a z-test?
What's the difference between a pooled and unpaired (Welch's) two-sample t-test?
How large a sample do I need for a t-test?
What if I want to compare more than two group means?
Share this article
Written by
Statistics Fundamentals Editorial Team
Written and reviewed by our team of statistics educators. Content is aligned with GCSE, A-Level, AP Statistics, and undergraduate curricula.
About Statistics Fundamentals β