Student's t test
- Statistical test
It compares two means and says whether the gap between them is larger than chance would explain.
What it is
The t test compares the mean of a numerical variable between two independent groups, or between two measurements in the same people (paired t test). Its statistic is the difference in means divided by its standard error, compared with Student’s t distribution for the degrees of freedom. It assumes roughly normal data (or large samples) and, in the classic independent version, similar variances.
When to use it
- Two means of independent groups, or one mean of paired differences.
- Continuous numerical outcome, roughly normal in each group.
- With large samples, t behaves like z and tolerates moderate departures from normality.
Worked example
- Data: kilograms lost over 8 weeks on diet A (5 people): 4, 6, 5, 7, 8; on diet B (5 people): 2, 3, 4, 3, 3.
- Means: A = 30 / 5 = 6 kg; B = 15 / 5 = 3 kg. Difference = 3 kg.
- Variances: A = (4 + 0 + 1 + 1 + 4) / 4 = 2.5; B = (1 + 0 + 1 + 0 + 0) / 4 = 0.5.
- Pooled variance = (4 × 2.5 + 4 × 0.5) / (5 + 5 − 2) = 12 / 8 = 1.5.
- SE of the difference = √[1.5 × (1/5 + 1/5)] = √0.6 = 0.77 kg.
- t = 3 / 0.77 = 3.87 with 8 degrees of freedom.
- Two-sided critical value at α = 0.05 and 8 df = 2.31. Since 3.87 > 2.31, H0 is rejected; p ≈ 0.005.
- Reading: diet A lost 3 kg more on average; the gap is unlikely to be due to chance alone, although the sample is tiny.
Markers
- t
- df
- Welch
How to read the result
- Report the difference in means with its 95% CI, not just t and p.
- When the same people are measured twice, the paired test usually has far more power than the independent one.
Assumptions and pitfalls
- Using the independent test on paired data.
- Applying it to ordinal or very skewed variables with small samples.
- Running many t tests between pairs of groups instead of one ANOVA.
Test yourself
Think of the answer, then tap the question to see it.
When is a paired t test used?
When both measurements come from the same people (before and after) or from matched pairs; the within-pair differences are analysed.
What are the assumptions of the independent-samples t test?
A numerical variable, independent observations, a roughly normal distribution in each group and, in the classic version, similar variances.
Which non-parametric test replaces the independent t test?
The Mann-Whitney U test.
Why not run several t tests to compare four groups?
Because each test adds false-positive risk; with 6 comparisons the overall type I error rises well above 5%. ANOVA is used instead.
Connections
Educational content on epidemiological and statistical methods; the examples use made-up numbers to teach the calculation. Not a clinical or legal guide: current Colombian rules are in the official sources.
Sources: Two-Sample t-Test for Equal Means (NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology, 2012); Analysis of paired observations (NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology, 2012).
Spotted a mistake?We are always improving for the community. Tell us what is wrong and our team will review it.Report a mistake
Representative model, for educational purposes only.
