Skip to main content

Two-sample t-test

Two-sample t-test is a hypothesis test that asks whether the means of two independent groups differ significantly. The test statistic divides the difference in sample means by the pooled standard error.

Also known asindependent t-test

ByHoang TruongUpdated

FrameworkStudent's t-test

See it move

Loading infographic...

A side-by-side comparison shows two independent groups: Method A with a sample mean of 74 (n = 20) and Method B with a sample mean of 68 (n = 20). The mean difference of 6 is divided by a pooled standard error of 3.0, giving a t-statistic of 2.0; the critical value at 5% significance with 38 degrees of freedom is approximately 2.024, so the difference is narrowly not statistically significant. This illustrates that a gap which appears large in practice can still fall short of the threshold for rejection.

Where it fits
SubjectData Analysis & StatisticsCoreTopicCommon Significance TestsCore

The formula

LaTeX
t=xˉ1xˉ2sp1n1+1n2t = \frac{\bar{x}_1 - \bar{x}_2}{s_p \sqrt{\dfrac{1}{n_1} + \dfrac{1}{n_2}}}

Variables

Sample means of group 1 and group 2
Pooled standard deviation
Sample sizes of group 1 and group 2 (observations)

Assumes equal population variances; degrees of freedom = n₁ + n₂ − 2.

LaTeX
sp=(n11)s12+(n21)s22n1+n22s_p = \sqrt{\frac{(n_1 - 1)s_1^2 + (n_2 - 1)s_2^2}{n_1 + n_2 - 2}}

Variables

Sample variances of group 1 and group 2

Pooled standard deviation: a weighted average of both groups' variances, assuming the two population variances are equal.

Check yourself

PracticeCORE

An analyst wants to determine whether the mean annual return of actively managed equity funds differs from the mean annual return of index funds, using two independent random samples. Which test is most appropriate?

Select an answer to check your understanding.
Two-Sample t-Test — comparing two group means