Two-Sample T-Test Calculator
Compare means of two independent groups.
Enter at least 2 values for Group 1
Enter data for both groups
What Is a Two-Sample T-Test?
The two-sample t-test (independent samples t-test) determines whether two group means differ significantly.
Question answered: "Do these two groups have different average values?"
Examples:
- "Do patients on Drug A have different outcomes than those on Drug B?"
- "Do male and female employees have different salaries?"
- "Does the treatment group score higher than the control group?"
The Hypotheses
Null hypothesis (H₀): μ₁ = μ₂ (means are equal)
Alternative hypothesis (H₁):
- Two-tailed: μ₁ ≠ μ₂ (means differ)
- Right-tailed: μ₁ > μ₂ (Group 1 mean is greater)
- Left-tailed: μ₁ < μ₂ (Group 1 mean is less)
The Test Statistic
Pooled (Equal Variances)
Where is the pooled standard deviation.
Welch's (Unequal Variances)
df calculated by Welch-Satterthwaite formula (often non-integer)
Example Calculation
Scenario: Comparing test scores between two teaching methods.
Data:
- Method A: n = 25, mean = 78, SD = 12
- Method B: n = 30, mean = 85, SD = 14
Pooled SD: Sp = √[((24)(144) + (29)(196)) / 53] = √[9220/53] = 13.2
Test statistic: t = (78 - 85) / [13.2 × √(1/25 + 1/30)] t = -7 / [13.2 × 0.276] t = -7 / 3.64 t = -1.92
P-value: For df = 53 (two-tailed), p ≈ 0.06
Conclusion: Difference approaches significance but doesn't reach p < 0.05. Method B appears to produce higher scores, but evidence isn't conclusive.
Pooled vs. Welch: Which to Use?
Pooled (Student's t-test)
Use when:
- Variances are approximately equal (ratio < 2:1)
- Sample sizes are similar
- You have reason to believe variances are equal
Advantages:
- Slightly more powerful when assumptions hold
- Traditional approach in many fields
Welch's t-test
Use when:
- Variances may be unequal
- Sample sizes differ substantially
- You're unsure about equal variances
Advantages:
- Robust to unequal variances
- Nearly as powerful as pooled when variances are equal
- Many statisticians recommend as default
This calculator supports both—Welch's T-Test Calculator is a dedicated version.
Applications
Clinical Trials
Treatment vs. control group outcomes.
A/B Testing
Continuous metrics (time on site, revenue) between variants.
Educational Research
Comparing teaching methods, curricula, or interventions.
Manufacturing
Comparing processes, machines, or suppliers.
Psychology
Group differences in attitudes, behaviors, or performance.
Assumptions
Independence
- Observations within groups are independent
- Groups are independent of each other
- No subject appears in both groups
Normality
- Populations approximately normal, OR
- Sample sizes adequate (each n > 30)
The t-test is fairly robust to non-normality, especially with larger samples.
Homogeneity of Variance (for pooled)
- Population variances approximately equal
- Check: ratio of sample SDs < 2:1
- If violated, use Welch's t-test
Effect Size: Cohen's d
| d | Interpretation |
|---|---|
| 0.2 | Small |
| 0.5 | Medium |
| 0.8 | Large |
In the example: d = (78 - 85) / 13.2 = -0.53 (medium effect)
Confidence Interval for Difference
Example 95% CI: -7 ± 2.01 × 3.64 = (-14.3, 0.3)
The interval includes 0, consistent with non-significant result.
One-Tailed vs. Two-Tailed
Two-tailed (recommended default): Tests for any difference between groups.
One-tailed: Tests for difference in specified direction. Requires prior justification—don't use just to get lower p-value.
Common Mistakes
Violating Independence
Comparing related measurements (e.g., before-after) requires paired t-test, not independent samples.
Ignoring Unequal Variances
Large variance differences with pooled t-test leads to incorrect p-values. Use Welch's.
Multiple Comparisons
Comparing 5 groups pairwise (10 tests) inflates false positive rate. Use ANOVA with post-hoc tests.
Small Sample + Non-Normal Data
With n < 15 and skewed data, consider Mann-Whitney U.
Reporting Results
APA format:
"An independent samples t-test revealed a significant difference between groups, t(53) = -1.92, p = .06, d = -0.53. Method B (M = 85, SD = 14) produced higher scores than Method A (M = 78, SD = 12), though the difference did not reach statistical significance."
Related Calculations
- One-Sample T-Test — Compare to known value
- Paired T-Test — Matched or repeated measures
- Welch's T-Test — Unequal variances
- Mann-Whitney U — Non-parametric alternative
- CI for Difference in Means — Interval estimate
- One-Way ANOVA — Compare 3+ groups
Summary
The two-sample t-test compares means between two independent groups. The pooled version assumes equal variances; Welch's version doesn't. The test produces a t-statistic compared against the t-distribution to obtain a p-value. Always check assumptions—independence is critical, normality matters mainly for small samples, and equal variances can be handled by choosing the appropriate version. Report effect sizes (Cohen's d) and confidence intervals alongside p-values for complete interpretation.