CalcUnit Logo

How to Calculate Two Sample T Test

Two Sample T Test Calculator: solve two sample t test problems online for free — formula, worked examples, and how-to guide included.

The Formula

t = (x̄1 − x̄2) / √(sp²(1/n1 + 1/n2))

The two sample t test formula uses the mathematical relationship: t = (x̄1 − x̄2) / √(sp²(1/n1 + 1/n2)). Each variable in the formula represents a measurable quantity that affects the final result.

What Each Variable Means

Every value in the two sample t test formula, what it measures, and the value used in the worked example on this page:

VariableTypeExample value
Group 1 MeanInput (you provide)52
Group 1 Standard DeviationInput (you provide)8
Group 1 Size (n1)Input (you provide)25
Group 2 MeanInput (you provide)48
Group 2 Standard DeviationInput (you provide)9
Group 2 Size (n2)Input (you provide)25
Mean DifferenceResult (calculated)—
Pooled VarianceResult (calculated)—
Pooled Standard DeviationResult (calculated)—
Standard ErrorResult (calculated)—
t StatisticResult (calculated)—
Degrees of FreedomResult (calculated)—

Step-by-Step Method

  1. 1Write down the values you know: Group 1 Mean, Group 1 Standard Deviation, Group 1 Size (n1), Group 2 Mean, Group 2 Standard Deviation, Group 2 Size (n2).
  2. 2Substitute your known values into the formula: t = (x̄1 − x̄2) / √(sp²(1/n1 + 1/n2)).
  3. 3Work through the arithmetic in the standard order of operations — parentheses first, then exponents, then multiplication and division, then addition and subtraction.
  4. 4Check that your result carries the correct unit and falls in a reasonable range for the problem.
  5. 5Verify your answer with the interactive Two Sample T Test Calculator — it solves the same formula instantly.

Worked Example

Take a concrete case: group 1 mean = 30, with the other inputs at the typical values from the variables table above. Substituting into the formula gives mean difference = -18.0000, pooled variance = 72.5000, pooled standard deviation = 8.5147, standard error = 2.4083, t statistic = -7.4741, degrees of freedom = 48. These numbers are solved by the same engine that powers the Two Sample T Test calculator, so you can reproduce them exactly by entering the same inputs there.

Group 1 MeanMean DifferencePooled VariancePooled Standard DeviationStandard Errort StatisticDegrees of Freedom
10-38.000072.50008.51472.4083-15.778648
30-18.000072.50008.51472.4083-7.474148
40-8.000072.50008.51472.4083-3.321848
502.000072.50008.51472.40830.830548
7022.000072.50008.51472.40839.135048
8032.000072.50008.51472.408313.287348
10052.000072.50008.51472.408321.591848
200152.000072.50008.51472.408363.114648

How each result changes as group 1 mean changes, holding the other inputs constant.

Practice Problems

1. Two class sections: Given Group 1 Mean 52, Group 1 Standard Deviation 8, Group 1 Size (n1) 25, Group 2 Mean 48, Group 2 Standard Deviation 9, and 1 more more inputs, what does it come out to?

Answer: The calculator returns Mean Difference 4.0000, Pooled Variance 72.5000, Pooled Standard Deviation 8.5147, Standard Error 2.4083, t Statistic 1.6609, and 1 more more results for Group 1 Mean 52, Group 1 Standard Deviation 8, Group 1 Size (n1) 25, Group 2 Mean 48, Group 2 Standard Deviation 9, and 1 more more inputs.

2. You enter Group 1 Mean 37.5, Group 1 Standard Deviation 5, Group 1 Size (n1) 20, Group 2 Mean 27, Group 2 Standard Deviation 6, and 1 more more inputs — what does the calculator return?

Answer: With Group 1 Mean 37.5, Group 1 Standard Deviation 5, Group 1 Size (n1) 20, Group 2 Mean 27, Group 2 Standard Deviation 6, and 1 more more inputs, the results are Mean Difference 10.5000, Pooled Variance 30.5000, Pooled Standard Deviation 5.5227, Standard Error 1.7464, t Statistic 6.0123, and 1 more more results.

Frequently Asked Questions

What is the formula for two sample t test?

The formula is: t = (x̄1 − x̄2) / √(sp²(1/n1 + 1/n2)). Two Sample T Test Calculator: solve two sample t test problems online for free — formula, worked examples, and how-to guide included.

What values do I need to calculate two sample t test?

You need group 1 mean, group 1 standard deviation, group 1 size (n1), group 2 mean, group 2 standard deviation, group 2 size (n2). The calculator produces mean difference, pooled variance, pooled standard deviation, standard error, t statistic, degrees of freedom from those inputs.

What is the two sample t test when group 1 mean is 30?

With group 1 mean = 30, the result is mean difference = -18.0000, pooled variance = 72.5000, pooled standard deviation = 8.5147, standard error = 2.4083, t statistic = -7.4741, degrees of freedom = 48. This is worked through in full in the example on this page.

Related Topics

statisticstwo sample t testmath

Use the Interactive Calculator

Skip the manual math — get instant results with our free Two Sample T Test calculator.

Open Calculator

Related Calculators