Comparisons Math & Statistics

ANOVA vs t-Test

When to compare means with a t-test and when with ANOVA: the number of groups, the multiple-comparison problem with its error rates, and why F equals t squared for two groups.

Last reviewed:

AdSense Placeholder
Slot: header_reference_page
On this page

A t-test compares the means of two groups. One-way ANOVA compares the means of three or more, testing whether the variation between groups is large compared with the variation inside them (the F ratio). Run both with the t-Test Calculator and the ANOVA Calculator; background in t-test and p-value.

The multiple-comparison problem

Each pairwise test has a 5 % chance of a false alarm, and the chance grows as tests are added (this calculation assumes independent tests, an approximation).

Groups Pairwise t-tests needed Chance of at least one false positive at α = 0.05
3 3 14.3 %
4 6 26.5 %
5 10 40.1 %
6 15 53.7 %

Two groups: they are the same test

With exactly two groups a pooled-variance t-test and ANOVA give the same p-value, and F = t². For the samples 4, 5, 6, 7, 8 and 6, 7, 8, 9, 10, both give t² = F = 4.0 and p = 0.0805 (checked with SciPy).

Which to use

  • Two groups: t-test (Welch's version when the variances differ).
  • Three or more groups: ANOVA, then post hoc pairwise tests if it is significant.
  • The same group measured repeatedly: use the paired or repeated-measures versions of both.
  • Strongly skewed data or tiny samples: consider a rank-based alternative (Mann-Whitney, Kruskal-Wallis).

Try these tools

See also

  • Glossary t-test
    A t-test judges whether the difference between means, from one or two small samples, is bigger than chance would explain.
  • Glossary p-value
    A p-value is the probability of seeing results at least as extreme as yours if there were really no effect.
  • Glossary Variance
    Variance is the average of the squared distances of values from their mean, a measure of how spread out they are.
  • Glossary Chi-square test
    A chi-square test compares observed counts with the counts expected under a hypothesis to see whether the gap is more than chance.
  • Guide How Standard Deviation Works
    What standard deviation measures, a worked step-by-step example, why samples divide by n − 1, the 68-95-99.7 rule.
  • Cheat sheet Statistics Formulas Cheat Sheet
    Mean, standard deviation, z-score, confidence intervals, chi-square.

Frequently Asked Questions

You can, but each extra test adds a chance of a false positive. With 3 groups and a 5 % level the chance of at least one false positive across the 3 pairwise tests is about 14 %. ANOVA tests all the groups at once and keeps it at 5 %.

That at least one group mean differs, not which one. A follow-up (post hoc) test such as Tukey's HSD finds the pairs.

AdSense Placeholder
Slot: footer_leaderboard