How this instrument works
The two-sample t-test compares the means of two independent samples — a treatment group versus a control, or two manufacturing batches — to test whether the difference between them, x-bar1 − x-bar2, is larger than ordinary sampling variation would produce on its own. It's a different question from the one-sample t-test's: instead of asking whether one sample's mean differs from a fixed hypothesized value, it asks whether two samples' means differ from each other.
This calculator uses the pooled-variance version, which assumes both groups share roughly the same underlying variance and combines their two sample variances into a single pooled estimate, sp^2, weighted by each group's degrees of freedom (n − 1). That pooled variance then feeds into the standard error used to compute t = (x-bar1 − x-bar2) / sqrt(sp^2 x (1/n1 + 1/n2)). Pooling makes the most efficient use of both samples' information when the equal-variance assumption is reasonable, something often checked beforehand with an F-test comparing the two sample variances.
The resulting t-statistic is compared against a t-distribution with n1 + n2 − 2 degrees of freedom — the combined degrees of freedom lost to estimating each group's own mean separately. That's a different degrees-of-freedom count from the one-sample case's simple n − 1, since two separate means are being estimated here instead of one; for this two-sample case, add each group's own n − 1 together rather than using the one-sample formula on either group alone.
- Enter the first group's average into Sample 1 mean (x-bar-1), its spread into Sample 1 standard deviation (s1), and its count into Sample 1 size (n1).
- Enter the second group's matching figures into Sample 2 mean (x-bar-2), Sample 2 standard deviation (s2), and Sample 2 size (n2).
- Read Pooled variance (sp^2) — the combined variance estimate the t-statistic is built from.
- Read the t-statistic, then compare it against a t-distribution with n1 + n2 − 2 degrees of freedom to judge whether the two groups' means differ significantly.
- Testing a single sample against one fixed hypothesized value instead of two groups against each other? Use this site's one-sample t-statistic instrument.
Worked example — two samples of 25, means 105 and 100
Group 1 has n1 = 25 observations with mean x-bar1 = 105 and standard deviation s1 = 15; Group 2 has n2 = 25 observations with mean x-bar2 = 100 and standard deviation s2 = 15. Enter all six figures into their matching fields.
The instrument first pools the variances: sp^2 = ((24 x 225) + (24 x 225)) / 48 = 10800 / 48 = 225. It then computes the standard error, sqrt(225 x (1/25 + 1/25)) = sqrt(225 x 0.08) = sqrt(18) = 4.242641, and t-statistic reads (105 − 100) / 4.242641 = 1.178511.
With n1 + n2 − 2 = 48 degrees of freedom, a t of 1.178511 falls well short of the roughly 2.01 threshold typically needed for significance at the 5% level on a two-tailed test — so this particular five-point gap between the two group means is well within the range ordinary sampling variation could produce, not strong evidence of a real difference.
Questions
How is this different from the one-sample t-statistic calculator?
The one-sample version tests a single sample's mean against one fixed hypothesized value, like 'is this batch's average weight still 100 grams?' This two-sample version compares two independently collected samples' means against each other, like 'is batch A's average weight different from batch B's?', using a pooled variance built from both samples instead of a single sample standard deviation.
What does 'pooled variance' mean and why combine the two samples' variances?
Pooled variance, sp^2, is a weighted average of the two groups' individual sample variances, weighted by each group's degrees of freedom (n − 1). Combining them into one shared estimate makes more efficient use of both samples' information than using either group's variance alone — but it's only appropriate when the two groups' true variances are reasonably similar, which is the equal-variance assumption behind this test.
What if my two groups don't have equal variances?
The pooled-variance formula on this page assumes roughly equal variances between the two groups. If that assumption looks shaky, for example if an F-test on the two standard deviations shows a large difference, the more robust choice is Welch's t-test, which doesn't pool the variances and instead uses a separate-variance formula with an adjusted degrees of freedom.
How many degrees of freedom does the two-sample t-test use?
n1 + n2 − 2 — the two sample sizes added together, minus 2 for the two separate means being estimated, one per group. In the worked example, that's 25 + 25 − 2 = 48 degrees of freedom, the value to look up in a t-table alongside the computed t-statistic of 1.178511.
What does a t-statistic of 0 mean in this test?
It means the two sample means are exactly equal, so there's no observed difference to explain, regardless of how large or small the pooled variance turns out to be — the numerator of the t formula, x-bar1 − x-bar2, is simply zero. Two groups sharing an identical mean of 80 but different spreads would still produce t = 0.