t-tests: which one do you need?

Analytika TeamLast reviewed 7 min read

The t-test is the workhorse for comparing means. It was developed by William Gosset, a chemist at the Guinness brewery, and published in 1908 under the pen name “Student”. There are three versions, and choosing the right one depends entirely on how your data were collected.

Which t-test do you need?

Your designTestNull hypothesis
One group, compared with a known or target valueOne-sample t-testμ = target
Two separate groups of different peopleIndependent samples t-testμ₁ = μ₂
The same people measured twice, or matched pairsPaired samples t-testμ_difference = 0

A quick test: can you draw a line connecting each value in one column to a specific value in the other, because they come from the same person, twin or matched case? If yes, use the paired test. If the groups are just two separate sets of people, use the independent test.

What all three have in common

Every t-test calculates the same kind of ratio:

t = (observed difference) / (standard error of that difference)

The top is the difference you care about. The bottom is how much that difference would bounce around by chance. A large |t| means the difference is big relative to the noise, which gives a small p-value. The p-value comes from the t-distribution, which looks like a normal curve with heavier tails, to account for estimating the SD from a small sample.

The three tests, with real examples

One-sample t-test

Compares a sample mean with a fixed value: a population norm, a target or a scale midpoint. Example: is the average fuel economy of the 32 cars in the mtcars dataset different from 20 mpg? The mean is 20.09, and the test gives t(31) = 0.09, p = .933, d = 0.02. There’s no evidence the average differs from 20.

Independent samples t-test

Compares the means of two separate groups. Example: do guinea pigs given vitamin C as orange juice show different tooth growth from those given ascorbic acid (30 per group)? t(58) = −1.92, p = .060: no evidence of a difference at α = .05. There’s an important variant, Welch’s t-test, which doesn’t assume equal variances. The full lesson walks through this example step by step.

Paired samples t-test

Compares two measurements on the same cases by testing whether the average difference is zero. Example: ten patients each tried two sleeping drugs. Drug 2 gave 1.58 more hours of extra sleep on average, t(9) = −4.06, p = .003. Analysed (wrongly) as two independent groups, the same data give p = .079. Pairing removes the patient-to-patient variation. See the paired t-test lesson.

Assumptions

  • Continuous outcome, measured on an interval or ratio scale.
  • Independent observations: within each group for the independent test, and between pairs for the paired test.
  • Approximate normality: of the values in each group (one-sample, independent) or of the differences (paired). This matters most in small samples.
  • Equal variances: independent test only, and Welch’s version removes this requirement.

If the normality assumption clearly fails, each t-test has a rank-based alternative: one-sample Wilcoxon, Mann-Whitney U and Wilcoxon signed-rank. See parametric vs non-parametric tests.

Why not use several t-tests for three or more groups?

Comparing three groups takes three pairwise t-tests, and each has a 5% false-positive rate. The chance of at least one false positive across the set rises to about 14%, and it keeps climbing with more groups. A one-way ANOVA tests all the groups at once, and post-hoc tests then compare pairs with the error rate controlled.

Reporting any t-test

Give the group means and SDs, then t(df) = value, p = value, an effect size (usually Cohen’s d) and a confidence interval for the difference:

t(9) = −4.06, p = .003, d = −1.28, mean difference 95% CI [−2.46, −0.70]

Have summary statistics but not the raw data? Our free t-test calculator runs all three versions from means, SDs and sample sizes.

More in Comparing groups

Try it with the free tools

Run this on your own data

Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.

Try it free