Two-Sample t Interval Calculator
Test cases replayed : 3 of 3 match · Methodology · No outside source listed
Enter the mean, standard deviation and size of two independent samples and a confidence level. You get the confidence interval for the difference of the population means, with its margin of error.
Result
Confidence interval for μ₁ − μ₂
Point estimate x̄₁ − x̄₂
- Standard error of the difference
- Degrees of freedom (ν)
- Critical value t*
- Margin of error t* × SE
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Sample 1 mean (x̄₁): enter a number.
- Sample 1 standard deviation (s₁): enter 0 or more.
- Sample 1 size (n₁): enter 2 or more.
- Sample 2 mean (x̄₂): enter a number.
- Sample 2 standard deviation (s₂): enter 0 or more.
- Sample 2 size (n₂): enter 2 or more.
- Confidence level, in percent: enter a number from 50 to 99.9.
- Variance assumption: choose Unequal variances (Welch) or Equal variances (pooled).
- Read the result: Confidence interval for μ₁ − μ₂; the panel also shows Point estimate x̄₁ − x̄₂, Standard error of the difference, Degrees of freedom (ν), Critical value t* and Margin of error t* × SE.
How this calculator works
Interval = (x̄₁ − x̄₂) ± t* × SE, where t* is the quantile of Student's t distribution with ν degrees of freedom that leaves (1 − confidence) ÷ 2 in each tail.
Welch: SE = √(s₁²/n₁ + s₂²/n₂) and ν = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)] (Welch–Satterthwaite). Pooled: s_p² = [(n₁ − 1)s₁² + (n₂ − 1)s₂²] ÷ (n₁ + n₂ − 2), SE = s_p √(1/n₁ + 1/n₂) and ν = n₁ + n₂ − 2. These are the formulas of the NIST/SEMATECH e-Handbook of Statistical Methods, section 1.3.5.3, and of this site's t-test calculator.
The fractional Welch degrees of freedom are used as they are, without rounding. Results are shown with up to 4 decimal places.
Worked example
| Sample 1 mean (x̄₁) | 52.3 |
|---|---|
| Sample 1 standard deviation (s₁) | 6.1 |
| Sample 1 size (n₁) | 30 |
| Sample 2 mean (x̄₂) | 48.9 |
| Sample 2 standard deviation (s₂) | 7.4 |
| Sample 2 size (n₂) | 25 |
| Confidence level | 95% |
| Variance assumption | Unequal variances (Welch) |
| Confidence interval for μ₁ − μ₂ | (-0.3272, 7.1272) |
|---|---|
| Point estimate x̄₁ − x̄₂ | 3.4 |
| Standard error of the difference | 1.8522 |
| Degrees of freedom (ν) | 46.5289 |
| Critical value t* | 2.0123 |
| Margin of error t* × SE | 3.7272 |
Frequently asked questions
What does it mean if the interval contains 0?
At that confidence level the data are consistent with no difference between the two means. A two-sided t-test at the matching significance level (5% for a 95% interval) would not reject equal means.
Welch or pooled?
Welch's interval does not assume equal variances and is the usual default. The pooled interval is valid only if both populations have the same variance; with unequal sample sizes it can be noticeably narrower or wider than Welch's.
My textbook uses the smaller of n₁ − 1 and n₂ − 1 as degrees of freedom. Why is the answer different?
That is a conservative shortcut for hand calculation; it gives a wider interval. Software and the NIST handbook use the Welch–Satterthwaite value shown here.