Statistics and research
T-test calculator
One-sample, independent two-sample (Welch and pooled) and paired t-tests from raw data or summary statistics, with confidence intervals and Cohen’s d.
Runs in your browser. What you enter stays on this page and is not uploaded.
Results
- Mean difference (1 − 2)
- -1.58
- Hypothesis
- two-sided, difference ≠ 0
- Cohen’s d (pooled SD)
- -0.83218
- Hedges’ g (bias-corrected)
- -0.79694
- Conclusion (Welch)
- The difference is not significant at the 5% level.
| Group | n | Mean | SD | SE |
|---|---|---|---|---|
| Sample 1 | 10 | 0.75 | 1.78901 | 0.565735 |
| Sample 2 | 10 | 2.33 | 2.00225 | 0.633167 |
| Test | t | df | p-value | Estimate | SE | 95% CI lower | 95% CI upper |
|---|---|---|---|---|---|---|---|
| Welch (unequal variances) | -1.86081 | 17.7765 | 0.07939 | -1.58 | 0.849091 | -3.36548 | 0.205483 |
| Student (pooled variance) | -1.86081 | 18 | 0.07919 | -1.58 | 0.849091 | -3.36387 | 0.203874 |
Welch’s test is the default (as in R): it does not assume equal variances and loses little when they are equal. Student’s pooled test is shown for comparison.
Method and limits
How to use it
Choose the test, then paste raw data or enter summary statistics (n, mean, SD). For paired data list both samples in the same order — each position is one pair. Set the hypothesized difference (usually 0), the alternative and the confidence level.
Formulas
- One sample: t = (x̄ − μ₀) / (s / √n), df = n − 1.
- Paired: a one-sample t-test on the differences d = x₁ − x₂.
- Welch: t = (x̄₁ − x̄₂ − Δ₀) / √(s₁²/n₁ + s₂²/n₂), with Welch–Satterthwaite df = (v₁ + v₂)² / (v₁²/(n₁ − 1) + v₂²/(n₂ − 1)), vi = si²/ni.
- Student (pooled): sp² = ((n₁ − 1)s₁² + (n₂ − 1)s₂²) / (n₁ + n₂ − 2), t = (x̄₁ − x̄₂ − Δ₀) / (sp √(1/n₁ + 1/n₂)), df = n₁ + n₂ − 2.
- Confidence interval: estimate ± tcrit × SE (one-sided intervals for one-sided alternatives, as R).
- Cohen’s d = (x̄₁ − x̄₂) / sp; Hedges’ g = J d with J = Γ(ν/2) / (√(ν/2) Γ((ν − 1)/2)).
Assumptions and limits
- Independent observations (within and between groups for the two-sample test).
- Approximately normal data, or differences for the paired test; with 30 or more per group the test is robust to moderate non-normality. For small skewed samples use the Mann–Whitney or Wilcoxon test.
- Welch’s test is the default because it does not need equal variances and loses almost nothing when they are equal (as R’s t.test).
Worked example
R’s sleep data (extra hours of sleep with two drugs, 10 patients each): Welch’s t = −1.861 with 17.78 df, p = 0.0794, 95% CI −3.365 to 0.205; the pooled test gives p = 0.0792. Treated as paired (the same patients took both drugs), t = −4.062 with 9 df, p = 0.00283, CI −2.460 to −0.700 — identical to R’s t.test.
References
- NIST/SEMATECH e-Handbook of Statistical Methods: two-sample t-test for equal means
- R documentation: t.test
- Welch (1947), The generalization of “Student’s” problem when several different population variances are involved, Biometrika 34
- Student (1908), The probable error of a mean, Biometrika 6(1)
- Hedges (1981), Distribution theory for Glass’s estimator of effect size, Journal of Educational Statistics 6(2)
Related tools
- Mann–Whitney U test calculatorWilcoxon rank-sum (Mann–Whitney U) test for two independent samples, exact for small samples without ties, with the rank-biserial effect size.
- Wilcoxon signed-rank test calculatorWilcoxon signed-rank test for paired samples or one sample against a median, exact for small samples, with the matched-pairs rank-biserial correlation.
- Effect size calculatorCohen’s d, Hedges’ g and Glass’s Δ from group means, or odds ratio, risk ratio and risk difference from a 2×2 table, each with confidence intervals.
- Power and sample size calculatorStatistical power or the sample size needed for one-sample, paired and two-sample t-tests and for comparing two proportions.
- P-value calculatorFind the p-value and critical values for a z, t, chi-square or F test statistic, one- or two-tailed, accurate far into the tails.
- One-way ANOVA calculator with Tukey HSDCompare the means of two or more groups: ANOVA table, η² and ω², Welch’s ANOVA, and Tukey–Kramer pairwise intervals with adjusted p-values.