What is ANOVA?
Last updated: 2026-11-23
ANOVA, short for analysis of variance, asks whether the means of three or more groups differ by more than the spread inside the groups would produce by chance. It splits the total variation in the scores into a part that sits between the groups and a part that sits within them, and compares the two as a ratio called F. A large F means the group means are far apart compared with the noise inside each group.
Start learning No account needed
With only two groups it gives the same answer as the pooled two-sample t test.
1. What ANOVA compares, and why not several t tests
Suppose you have three groups and want to know whether their true means are all the same. You could run a t test on each pair, which makes three tests. The trouble is that each test at alpha 0.05 carries a 5 percent chance of a false alarm when nothing is going on, and the chances add up across tests. If the three tests were independent, the chance of at least one false alarm would be 1 − 0.953 = 0.1426, about 14 percent. The tests share data, so the true figure is not exactly that, but it is well above 5 percent and it grows as you add groups.
ANOVA asks one question about all the groups together. The null hypothesis H0 is that all the true means are equal, and the test is made once, at the alpha you chose before looking. The hypothesis testing logic is the same as for a t test, and the result is read as a p-value from the F distribution.
2. A worked example: three teaching methods, four scores each
Twelve students are split into three groups of four, and each group learns the same unit by a different method. Their quiz scores out of 100 are below. H0 is that the three methods have the same true mean, and you choose alpha 0.05 before looking.
| Method | Scores | Mean | Squared deviations from the group mean, summed |
|---|---|---|---|
| Lecture | 68, 72, 75, 73 | 72 | 26 |
| Flipped class | 74, 78, 80, 76 | 77 | 20 |
| Tutoring group | 69, 73, 70, 74 | 71.5 | 17 |
The group means are 72, 77 and 71.5, and the grand mean of all twelve scores is 73.5. The within-group sum of squares adds up the squared distances of each score from its own group mean, which are the sums in the last column: 26, 20 and 17, so SS within = 63. The between-group sum of squares measures how far each group mean sits from the grand mean, counting each mean once per student in the group: 4 × (72 − 73.5)2 + 4 × (77 − 73.5)2 + 4 × (71.5 − 73.5)2 = 9 + 49 + 16, so SS between = 74. Together they make up the total variation around the grand mean: 74 + 63 = 137.
A sum of squares grows with the number of values, so each is divided by its degrees of freedom to get a mean square. Three groups give 3 − 1 = 2 degrees of freedom between, and twelve scores less three group means give 12 − 3 = 9 within. The mean square between is 74 / 2 = 37, and the mean square within is 63 / 9 = 7. The mean square within is the average noise inside a group, and the mean square between is how much the means vary, scaled to the same units. Their ratio is F = 37 / 7 = 5.29.
If H0 were true, the group means would vary only as much as the noise allows, and F would usually sit near 1. The cutoff for F at alpha 0.05 with 2 and 9 degrees of freedom (df 2 and 9) is 4.256, and 5.29 is above it. The p-value is 0.0303, so you reject H0. The data are unlikely enough under equal means that you take the differences seriously, though a p-value of 0.0303 is not a probability that H0 is true, as what is a p-value explains. Output from the script, run on 2026-11-23: F = 5.29, p = 0.0303. It comes from a short script, anova-example.mjs, that does the same arithmetic.
3. F compares the means with the noise
The same group means can give a very different F. Keep the means at 72, 77 and 71.5, but let the scores inside each group spread out: lecture 60, 85, 66, 77; flipped class 66, 90, 72, 80; tutoring group 58, 84, 65, 79. The between-group sum of squares is still 74, because the means did not change. The within-group sum of squares jumps from 63 to 1135, and F = 0.29, with a p-value of 0.7526. The gaps between the methods are the same size, but they are now small compared with how much the students inside each method differ, so there is no case against H0.
This is the same idea as in a t test. A gap between means only means something when it is read against the noise, and ANOVA does that for all the groups at once.
4. Two groups: ANOVA and the t test agree
Run the example on the lecture and flipped groups alone. SS between is 50 and SS within is 46, with 1 and 6 degrees of freedom, so F = 50 / (46 / 6) = 6.52. The two-sample t test on the same scores, as set out in what is a t test, gives t = 2.55, and 2.55 squared is 6.52. The p-value is 0.0433 for both. With two groups, F is t squared, and ANOVA matches the pooled t test.
5. A common misconception: a significant F means all the groups differ
It is easy to read the result above as saying that the three methods give three different results. It says less than that. A significant F tells you the group means are not all equal, so at least one differs from the others, and it does not say which one. In the example the flipped class mean is 5 points above the lecture mean and 5.5 points above the tutoring mean, while the lecture and tutoring means are half a point apart. The F of 5.29 is driven mostly by the flipped class, and the data give no sign that lecture and tutoring differ.
To find out which pairs differ you run follow-up comparisons, often called post-hoc tests, such as Tukey's test. These compare the groups two at a time while accounting for the number of comparisons, which brings back the false-alarm problem from section 1. We do not compute them here. The reverse also holds, since a non-significant F does not show that the means are equal, only that these data do not rule out chance.
6. Test yourself
Close this page and, for each of these, say what the null hypothesis is and which part of the F ratio changes: the same three group means but twice as much spread inside the groups; a fourth group added with the same mean as the grand mean; the same data analyzed with only two of the groups. Then reopen the page and compare. The case you hesitated on is the part to study again.
For the general method, see how to test yourself.
What the sources found, and their limits
Introduction to Modern Statistics, chapter 22. Mine Çetinkaya-Rundel and Johanna Hardin, OpenIntro, second edition. It supports the null hypothesis that all group means are equal against the alternative that at least one differs, the mean square between groups with k - 1 degrees of freedom and the mean square error with n - k, the three conditions (independent observations, nearly normal responses within each group, and about equal variability across groups), and the warning against running many pairwise tests. Source: Inference for comparing many means, read on 2026-11-23.
NIST/SEMATECH e-Handbook of Statistical Methods, sections 7.4.3 and 7.4.7. NIST, the U.S. National Institute of Standards and Technology. It supports one-way and two-way ANOVA, including the interaction as its own null hypothesis, and it says that after equality of means is rejected, repeating pairwise comparisons does not keep the overall significance level, so procedures such as Tukey's method are used instead. Sources: 7.4.3, Are the means equal? and 7.4.7, How can we make multiple comparisons?, read on 2026-11-23. Limits: neither source states that F equals t squared for two groups, so we checked that on the worked scores with the script. The two-sample t test in the book does not pool the spreads, which is why this page says the match is with the pooled version. The students, the quiz scores and all figures on this page are ours, made up to show the arithmetic.
How Professor Turing helps
Professor Turing is a tutor for adults learning any subject, in college or on their own. It asks you questions instead of giving the final answer, does not grade a bare guess, and remembers what you got wrong. No account is needed to start.
Bring a topic you are studying, such as how to read an ANOVA table. Its first reply asks what you already know before it teaches anything. If you answer with a bare guess, such as a term, it asks how you got there instead of saying right or wrong, and when you stay stuck it changes its approach and makes the next step smaller instead of giving the final answer. Later in a session it can offer a short test without help, scored apart from the tutoring, so you can tell what you can do alone from what the tutor carried you through.
It does not read or mark a written answer, and it does not write your explanation for you, so the explanation has to be yours. You must be 18 or older, and conversations are deleted after 7 days.
FAQ
What does ANOVA assume? It assumes the observations are independent of each other, that the scores in each group come from roughly bell-shaped distributions, and that the groups have a similar spread, since the within-group mean square pools them into one number. With four scores per group you cannot check these well from the data alone, so look at the scores themselves and consider how the groups were formed before you rely on the F value.
What is the difference between one-way and two-way ANOVA? A one-way ANOVA has one grouping factor, such as teaching method in our example. A two-way ANOVA has two, such as teaching method and class year, and it can also ask whether the effect of one factor depends on the level of the other, which is called an interaction. The idea of splitting the variation into parts and comparing them is the same.
Start with what you're working on
Tell the tutor which topic you are studying and let it ask you the questions.
Start learning No account needed
See also: all study guides