- Introduced by
- Student (W. S. Gosset)
- Year
- 1908
- Type
- Parametric mean comparison
What does it do?
The independent samples t-test is a parametric hypothesis test that compares the means of two independent groups to decide whether they differ significantly.
It is based on the t-distribution that Student (W. S. Gosset) introduced in 1908. The classic form assumes that the measured values are continuous, approximately normally distributed within each group, and have equal variances in the two groups.
The intuition behind the method
Often you have two separate groups — say a treatment group and a control group — measured on the same continuous outcome, and you want to know whether the difference in their averages is real or just sampling noise. The test scales the observed gap between the two means by how much the data naturally vary, so a difference only counts as significant when it is large relative to the spread within the groups.
History
The t-distribution was derived by William Sealy Gosset, writing under the pseudonym 'Student', in his 1908 Biometrika paper 'The probable error of a mean'. That paper addressed how to judge the significance of a mean when the sample is small and the standard deviation must be estimated from the same sample. The independent two-sample form was developed later from this work and is presented in standard textbooks such as Field (2013). Related variants include the paired t-test for matched observations and the Welch t-test, which relaxes the equal-variance assumption.
When to use it
Choose this test when you want to compare exactly two independent groups, with different units in each group, on one continuous outcome and the question is whether the population means differ. Three assumptions matter. Within each group, values should be approximately normally distributed, which is best judged from plots and sample size, with a test such as Shapiro-Wilk as a supplement. The classic form also requires equal variances between groups; if equal spread is doubtful, or group sizes are very unequal, the Welch correction is a robust choice. Observations must be independent both within and between groups; repeated measures on the same units call for the paired t-test. With very small samples or clear non-normality, the nonparametric Mann-Whitney U test is more appropriate, and with three or more groups one-way ANOVA is the right tool.
Limitations and considerations
- The pooled standard error assumes both groups share one population variance; when spreads differ, particularly with unequal group sizes, the reference distribution can be a poor fit, which is the reason the Welch correction exists.
- In small samples a few extreme values can dominate both the group means and the pooled variance, so the test is sensitive to outliers and skew.
- The test compares exactly two group means; its statistic does not extend to three or more groups without switching to the ANOVA framework.
- A non-significant result does not demonstrate equality of means, and with small samples the test may have little power to detect a real difference.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The pooled standard error uses both sample sizes and one shared spread estimate, giving a closed-form statistic whose reference distribution (Student t with n₁ + n₂ − 2 degrees of freedom) can be evaluated directly.
- Cohen's d is computed from the same pooled standard deviation as the test statistic, so the effect size and the test share one scale.
- When normality and equal variances hold, the test compares means directly, and the mean difference and its confidence interval are reported on the original measurement scale.
Applications
- Comparing outcomes of a treatment group versus a control group in clinical or experimental research.
- Testing whether two distinct populations (e.g. two regions, two cohorts) differ on a measured score.
- A/B testing of two design or product variants on a continuous metric.
- Comparing average performance of two methods, machines, or conditions in quality and lab studies.
How it works
How it works
The null hypothesis states that the two population means are equal; the alternative states that they differ. The test decides between these two claims.
Formula
H_0:\ \mu_1 = \mu_2 \quad H_1:\ \mu_1 \neq \mu_2
The t statistic divides the difference between the two sample means by the pooled standard error, s_p√(1/n₁ + 1/n₂). Here s_p is the pooled standard deviation, s_p = √(((n₁ − 1)s₁² + (n₂ − 1)s₂²) / (n₁ + n₂ − 2)), where s₁ and s₂ are the two group standard deviations; it is a weighted average of the two group variances. A larger mean difference or a smaller pooled spread pushes t further from zero, and larger samples reduce the standard error. The statistic is referred to a Student t-distribution with n₁ + n₂ − 2 degrees of freedom.
Formula
t = \dfrac{\bar{x}_1 - \bar{x}_2}{s_p \sqrt{\tfrac{1}{n_1} + \tfrac{1}{n_2}}}The two-tailed p-value is compared with a chosen significance threshold, conventionally 0.05; if it falls below, the null hypothesis of equal means is rejected. The 0.05 cut-off is a convention rather than a property of the test, so the p-value itself carries more information than the verdict. Reading the output: the sign of t shows which group mean is larger (positive when group 1 exceeds group 2); the degrees of freedom are n₁ + n₂ − 2 for the pooled form. Alongside the verdict, report the mean difference, its 95% confidence interval, and Cohen's d, which expresses the mean difference in units of the pooled standard deviation s_p. A non-significant result does not show that the means are equal; the confidence interval shows the range of differences that remain plausible.
Formula
\text{reject } H_0 \text{ if } p < 0.05;\quad d = \dfrac{\bar{x}_1 - \bar{x}_2}{s_p}Common pitfalls
- Using the pooled-variance form without considering equal spread; if group spreads clearly differ, especially with unequal group sizes, use the Welch correction. A preliminary variance test such as Levene's has limited power and should not be the only basis for the choice.
- Treating p < 0.05 as the whole result. A significant p-value indicates the difference is statistically detectable, not how large it is, so report the mean difference, its 95% confidence interval, and Cohen's d.
- Running several pairwise t-tests across three or more groups, which inflates the false-positive rate; use one-way ANOVA instead.
- Reading a non-significant result as proof that the groups are equal.
Frequently asked questions
One-tailed or two-tailed?
The default is two-tailed, testing whether the means differ in either direction. Use a one-tailed test only when you have a directional hypothesis decided before seeing the data; it concentrates the rejection region on one side and is easier to reject but only in the predicted direction.
Student or Welch — which version should I use?
The classic Student t-test pools the variances and assumes the two groups have equal spread. The Welch correction does not assume equal variances and adjusts the degrees of freedom accordingly, so it is a robust default when equal spread is doubtful or group sizes differ. Deciding between the two solely on a preliminary Levene test is discouraged because that test has low power.
Why report an effect size?
The p-value only tells you whether a difference is statistically detectable, not how large it is. Cohen's d expresses the mean difference in standard-deviation units, so you can judge practical importance. Reporting the mean difference and its 95% confidence interval is recommended alongside d.
How is this different from ANOVA?
The independent t-test compares exactly two group means. When you have three or more groups, use one-way ANOVA instead of running multiple t-tests, which would inflate the false-positive rate.
Related methods
Sources
Student (1908). The probable error of a mean. Biometrika, 6(1), 1–25.
Open DOI referenceField, A. (2013). Discovering Statistics Using IBM SPSS Statistics (4th ed.). SAGE.
ISBN: 978-1446249185