Change language

Learn to calculate by playing with t-test calculator

A short game to see where the result comes from. Pick a language and start; you can stop halfway and come back.

Loading the game…

← Back to t-test calculator

What you will practise

Compare two means (independent or paired) or one mean with a value, with p value, confidence interval and effect size.

How it works

The t statistic is the difference in means divided by its standard error: how many standard errors separate the means. With that value and the degrees of freedom you get the p value, the probability of seeing a difference this large (or larger) if there were really none.

For independent groups, the classic t pools the variances and requires them to be equal; Welch’s does not, and adjusts the degrees of freedom. For paired samples you work with each pair’s difference, and for one sample, with the difference from the reference value. The confidence interval of the difference is the difference ± critical t × standard error.

Formula

Independent (Welch): t = (x̄₁ − x̄₂) / √(s₁²/n₁ + s₂²/n₂), df = (s₁²/n₁ + s₂²/n₂)² / [ (s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1) ]
Independent (Student): t = (x̄₁ − x̄₂) / √(s_p² (1/n₁ + 1/n₂)), df = n₁ + n₂ − 2
Paired: t = d̄ / (s_d / √n), df = n − 1 One sample: t = (x̄ − μ₀) / (s / √n), df = n − 1
CI = difference ± critical t × standard error d = difference / s_p (or s_d if paired) g = d × J(df)

Worked example

Example 1. Two independent groups.
Group 1: 12, 15, 14, 16, 13, 15 (mean 14.17). Group 2: 18, 17, 19, 16, 20, 18 (mean 18.00). With Welch, t = −4.60 on 9.98 degrees of freedom and p < .001. The difference is −3.83 (95% CI −5.69 to −1.98), with d = −2.66 and g = −2.45: a very large effect. The variances are almost equal (ratio 1.08), so Student would give practically the same.

Example 2. From a paper.
Group 1: mean 78, SD 8, n = 40. Group 2: mean 70, SD 9, n = 35. With Welch, t = 4.04 on 68.66 degrees of freedom, p < .001; a difference of 8 points (95% CI 4.05 to 11.95), d = 0.94.

Example 3. Before and after.
Ten patients score 72, 65, 80, 74, 68, 77, 70, 83, 66, 75 before and 78, 70, 85, 75, 74, 84, 73, 88, 71, 80 after. They improve by 4.8 points on average (95% CI 3.59 to 6.01): t(9) = 9.00, p < .001, d_z = 2.85.

Example 4. One sample.
Eight measurements (5.1, 4.9, 5.6, 5.2, 4.8, 5.4, 5.0, 5.3) against a reference value of 5: the mean is 5.16, t(7) = 1.72, p = .129. You cannot claim it differs from 5.

How to play

First pick your language. Then work through the challenges one by one: each sets out a case with real numbers and, if you get stuck, you can ask for a hint. When you answer, you see whether you got it right and why. Progress is saved only in your browser, so you can stop halfway and carry on another day.