T-Test Calculator
Compare means with a one-sample, two-sample (Welch or pooled) or paired t-test, from raw data or summary statistics, with every step.
10 numbers
10 numbers
Separate numbers with commas, spaces or new lines. A comma always separates, so write 1234, not 1,234.
t(16.18) = 3.56, p = .003, d = 1.59
95% confidence interval: 2.1848 to 8.6152
Significant at α = 0.05: p is below α, so the null hypothesis is rejected.
- t
- 3.5572
- Degrees of freedom
- 16.18
- Two-tailed p-value
- 0.002588
- Difference in means
- 5.4
- Standard error
- 1.518
- Cohen's dₛ
- 1.59
- Hedges' g
- 1.52
| Group | n | Mean | SD | SE |
|---|---|---|---|---|
| Group 1 | 10 | 21.5 | 3.9229 | 1.2405 |
| Group 2 | 10 | 16.1 | 2.7669 | 0.875 |
Normality is not tested.
Working
Paste your data, or type each group's mean, standard deviation and size, to test whether a mean differs from a value or two means differ from each other. The result is the t statistic, its degrees of freedom and p-value, a confidence interval for the difference, the effect size and a line ready to paste into a report in APA style, with every step of the working.
How to use it
One sample compares a mean with a hypothesised value. Two samples compares two independent groups, such as a treatment and a control group. Paired compares two measurements of the same people or things, such as before and after, matched in order; paste two spreadsheet columns into the first list and they fill both.
Raw data takes the values, separated by commas, spaces or new lines, up to 100,000 a group. Summary statistics takes each group's mean, standard deviation and n, or for pairs, those of the differences. Two samples use Welch's test unless you choose Pooled. The hypothesised mean or difference is 0 unless you change it; the alternative is two-sided, or one-sided either way; α is 0.05 to start. Nothing you enter leaves your browser.
How it is worked out
t is the distance between the estimate and the hypothesised value in standard errors. Welch's standard error adds the two groups' variances of the mean, and its degrees of freedom come from the Welch–Satterthwaite formula, so they are usually not whole. The pooled test combines the two variances into one and has n₁ + n₂ − 2 degrees of freedom. A paired test is a one-sample test on the differences.
The p-value comes from the t-distribution itself, computed rather than read from a table, as the P-Value Calculator does. The confidence interval is at 1 − α: two-sided for ≠, and a one-sided bound for > or <, matching the test. Effect sizes follow Lakens (2013): d for one sample, d_s with the pooled standard deviation for two, and d_z for pairs, each measured from the hypothesised value. Hedges' g corrects d_s for its small-sample bias with the exact factor J. The effect sizes are shown without confidence intervals.
One sample: t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1
Paired: the same on the differences dᵢ
Welch: SE = √(s₁²/n₁ + s₂²/n₂), t = (x̄₁ − x̄₂ − μ₀) ÷ SE
Welch–Satterthwaite: df = (s₁²/n₁ + s₂²/n₂)² ÷ ((s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1))
Pooled: sₚ² = ((n₁ − 1)s₁² + (n₂ − 1)s₂²) ÷ (n₁ + n₂ − 2), SE = sₚ√(1/n₁ + 1/n₂)
CI = estimate ± t(α/2, df) × SE
d = (x̄ − μ₀) ÷ s; d_s = (x̄₁ − x̄₂ − μ₀) ÷ sₚ; d_z = (d̄ − μ₀) ÷ s_d
g = d_s × J, J = Γ(ν/2) ÷ (√(ν/2) Γ((ν − 1)/2)), ν = n₁ + n₂ − 2
Examples
Two groups of 10, Welch's test
- Group 1
- 22, 25, 17, 24, 16, 29, 20, 23, 19, 20
- Group 2
- 18, 16, 15, 19, 17, 13, 21, 14, 16, 12
With the default options the result is t(16.18) = 3.56, p = .003, d = 1.59. The difference in means is 5.4, with a 95% confidence interval of 2.1848 to 8.6152. Pooled, the same data give t(18) = 3.56, p = .002, d = 1.59: with equal group sizes the two tests agree on t and differ only in the degrees of freedom.
- The mean and standard deviation of each group. x̄₁ = 21.5, s₁ = 3.9229; x̄₂ = 16.1, s₂ = 2.7669
- Welch's standard error adds each group's variance of the mean, s² ÷ n. SE = √(3.9229² ÷ 10 + 2.7669² ÷ 10) ≈ 1.518
- t is how many standard errors the difference in means lies from the hypothesised difference. t = (21.5 − 16.1 − 0) ÷ 1.518 ≈ 3.5572
- The Welch–Satterthwaite degrees of freedom, from the two variances of the mean. df = (1.5389 + 0.7656)² ÷ (1.5389² ÷ 9 + 0.7656² ÷ 9) ≈ 16.18
- The two-tailed p-value is the chance of a t at least this far from 0 either way. p = 2 × P(T₁₆.₁₈ > 3.5572) ≈ 0.002588
- The 95% confidence interval is the difference in means ± t × SE, with α ÷ 2 above t. 5.4 ± 2.118 × 1.518 → 2.1848 to 8.6152
- Compare p with α. p ≈ 0.002588 < 0.05, so the result is significant
The same values as pairs
Read as before-and-after pairs, matched in order, the differences give t(9) = 3.26, p = .010, d = 1.03, with d_z measured against the spread of the differences.
From means and standard deviations
Group 1 has mean 24.5, SD 4.2 and n = 12; Group 2 has mean 20.1, SD 3.6 and n = 11. Welch's test gives t(20.92) = 2.70, p = .013, d = 1.12; Cohen's dₛ is 1.12 and Hedges' g 1.08.
Sources
The test statistics, pooled variance and Welch–Satterthwaite degrees of freedom follow the NIST/SEMATECH e-Handbook and Welch (1947) and Satterthwaite (1946); Welch as the default follows Delacre, Lakens and Leys (2017); the effect sizes follow Lakens (2013) and Hedges (1981). The APA line follows APA Style's Numbers and Statistics Guide: t and d to two decimals, p to three with no zero before the point, and p < .001 below that.
Sources
- Numbers and Statistics Guide, APA Style 7th Edition — American Psychological Association
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.3 Two-sample t-test for equal means — National Institute of Standards and Technology
- Why psychologists should by default use Welch's t-test instead of Student's t-test (Delacre, Lakens and Leys, 2017) — International Review of Social Psychology
- Calculating and reporting effect sizes to facilitate cumulative science (Lakens, 2013) — Frontiers in Psychology
- Distribution theory for Glass's estimator of effect size and related estimators (Hedges, 1981) — Journal of Educational Statistics
- The generalization of 'Student's' problem when several different population variances are involved (Welch, 1947) — Biometrika
- An approximate distribution of estimates of variance components (Satterthwaite, 1946) — Biometrics Bulletin
Reviewed
Frequently asked questions
See also
- P-Value Calculator — for the p-value or critical value of a t from elsewhere, or of z, chi-square or F.
- Standard Deviation Calculator — for the mean and standard deviation of each group, with every step.
- Sample Size Calculator — for how many responses a study needs at a confidence level.