What Is a T-Test?
A t-test is a hypothesis test for a mean or a difference between two means when the population standard deviation is unknown. It compares an observed sample estimate to the value specified by the null hypothesis, scaled by the estimate's standard error. The result is a t statistic, which is evaluated against the Student's t-distribution with the appropriate degrees of freedom to produce a p-value or a critical-value comparison.
The Four T-Tests
- One-sample — compares the mean of a single sample to a hypothesized value μ₀.
- Two-sample (Student) — compares the means of two independent groups assuming equal population variances. Uses a pooled estimate of the standard deviation.
- Two-sample (Welch) — compares two independent group means without assuming equal variances. Uses a separate variance estimate for each group and Welch–Satterthwaite degrees of freedom, which can be fractional.
- Paired — compares two measurements from the same subjects or matched observations. Reduces to a one-sample test on the within-pair differences.
T-Test Formulas
Every t-test shares the same structure: the observed difference divided by its standard error.
One-sample: t = (x̄ − μ₀) / (s / √n), with df = n − 1.
Two-sample pooled: t = [(x̄₁ − x̄₂) − Δ₀] / [sp√(1/n₁ + 1/n₂)], where sp² = [(n₁−1)s₁² + (n₂−1)s₂²] / (n₁ + n₂ − 2), with df = n₁ + n₂ − 2.
Welch: t = [(x̄₁ − x̄₂) − Δ₀] / √(s₁²/n₁ + s₂²/n₂), with Welch–Satterthwaite degrees of freedom.
Paired: reduce the data to differences di = X1i − X2i, then t = (d̄ − μd0) / (sd / √n), with df = n − 1.
How to Calculate a T-Test
The steps are the same regardless of which t-test you use. What changes is the formula for the standard error and the degrees of freedom.
- Calculate the sample mean, or the difference between the two sample means, or the mean of the paired differences.
- Calculate the appropriate standard error for the chosen test.
- Subtract the hypothesized value from the estimate and divide by the standard error to get the t statistic.
- Determine the degrees of freedom for the test.
- Look up or compute the p-value from the t-distribution, or compare the statistic against the critical t value.
- Compare the p-value (or the statistic) against the chosen significance level α.
- Read the confidence interval and effect size alongside the decision — statistical significance and practical importance are separate questions.
T Statistic vs T-Test
The t statistic is a number — the observed difference divided by its standard error. A t-test is the complete procedure: compute the t statistic, pick the correct degrees of freedom, then compare the statistic either to a critical t value or to the t-distribution to get a p-value. The t statistic on its own is not a conclusion; it is one input into the test.
Degrees of Freedom and Critical Values
Degrees of freedom determine which t-distribution the statistic is evaluated against. For one-sample and paired tests, df = n − 1. For the pooled two-sample test, df = n₁ + n₂ − 2. Welch uses an approximation, so df can be fractional. As df grows, the t-distribution approaches the standard normal.
A critical t value is the boundary that marks the rejection region for the chosen α and tail. For a two-tailed test, α is split evenly between both tails, so the critical value is the upper quantile at 1 − α/2, symmetric ±t_crit. For one-tailed tests, the entire α sits in one tail. The sign of the t statistic only indicates direction — the magnitude relative to t_crit determines the decision.
P-Value and Decision
The p-value is the probability, under H₀, of a t statistic at least as extreme as the one observed, in the direction of the selected tail. If p < α, the result is statistically significant and H₀ is rejected. If p ≥ α, there is insufficient evidence to reject H₀. A significant result does not by itself establish the practical size or causal nature of the effect — that is what the effect size (Cohen's d, or dz for paired) and the confidence interval are for.
One-Tailed vs Two-Tailed
A two-tailed test asks whether the parameter differs from the null value in either direction. A right-tailed test asks only whether it is greater; a left-tailed test asks only whether it is less. Choose the alternative before seeing the data. Switching to a one-tailed test after the fact to gain significance is a form of p-hacking.
When to Use Each Test
- Comparing one sample mean to a fixed value — one-sample.
- Comparing two independent groups and equal variances are reasonable — Student's pooled test.
- Comparing two independent groups without assuming equal population variances — Welch's test.
- Measurements taken twice on the same subjects, matched pairs, or pre/post designs — paired test.
Assumptions
Independence of observations is required for all four tests. For small samples, the underlying population (or the paired differences) should be approximately normal — the t-test is robust to mild departures but sensitive to extreme outliers. The pooled two-sample test additionally assumes equal population variances; Welch's test does not. Paired data should be analyzed as paired observations when the measurements are naturally matched. Treating paired observations as independent ignores their within-pair dependence and can produce incorrect standard errors and p-values.
How to Report a T-Test
APA format: t(df) = value, p = value, d = value, 95% CI [low, high]. For example: t(8) = −4.70, p = .002, d = −2.97, 95% CI [−9.25, −3.15]. Report the test type (one-sample, pooled, Welch, or paired), the sample sizes, and the descriptive statistics alongside the test result.
Common Mistakes
- Running a two-sample test on paired data.
- Using Student's pooled test when variances clearly differ — Welch is the appropriate alternative.
- Reporting a one-tailed p-value after initially testing two-tailed.
- Treating a non-significant result as proof that there is no effect.
- Reading a small p-value as evidence of a large or important effect — that is what Cohen's d and the CI are for.
- Removing outliers without investigating them.