StatsDrillFree guides

Intro statistics · Comparing three or more means

ANOVA practice problems, with the idea behind the F test

One-way ANOVA asks one question: are the means of three or more groups all the same, or does at least one stand out? It answers by comparing two kinds of variation, the spread between the group means and the spread within each group. This guide starts with a tool you can play with, builds the ANOVA table one cell at a time, works three full examples, and ends with ten practice problems you can check.

The whole idea in one line: F = (variation between group means) ÷ (variation within groups). Means far apart compared with the noise inside each group give a big F and a small p-value.

See the idea first: spread explorer

Below are three groups of 5 measurements each. The thick bars are the group means and the dashed line is the overall mean. Use the two sliders: one moves the group means apart, the other changes how spread out each group is. Watch what happens to F and the p-value.

Group AGroup BGroup C
Dot plot of three groups of five values. Each thick bar marks a group mean; the dashed line marks the overall mean of 50.

Group means: 45, 50, 55. MS between = 125.0, MS within = 36.0, so F = 3.47 on (2, 12) df and p = 0.065. At α = 0.05 you would fail to reject H₀.

Things to try:

  • Keep the means where they are and drag the spread down to 2. F jumps to 31.25 and p drops below 0.001. The means didn’t move; the noise around them shrank.
  • Now drag the spread up to 10. F falls to 1.25 and p is about 0.32. The same gaps between means are now easy to explain by chance.
  • Set the distance to 0. Every group has the same mean, F = 0 and p = 1.

That is ANOVA in a nutshell. A difference between means only counts as evidence when it is large compared with the variation inside the groups.

Hypotheses: what H₀ and Hₐ actually say

For k groups with population means μ₁, μ₂, …, μₖ:

H₀: μ₁ = μ₂ = … = μₖ    Hₐ: at least one μ is different

Three things trip people up:

  1. Hₐ is not “all the means are different.” If two groups match and one is off, Hₐ is true.
  2. The hypotheses are about population means (μ), never sample means (x̄). Sample means almost always differ a little.
  3. There is no “one-sided” ANOVA. Hₐ has no direction, but the F test only rejects for large F (more on that in Reading the p-value).

Between vs within: two kinds of variation

Every data value sits some distance from the overall mean. ANOVA splits that distance into two pieces: how far the value’s group mean is from the overall mean, and how far the value is from its own group mean. Squaring and adding over all the data gives the famous split:

SS total = SS between + SS within

The two sources of variation in one-way ANOVA
PieceFormulaPlain Englishdf
Between groups (also called “treatment” or “factor”)SSB = Σ nᵢ(x̄ᵢ − x̄)²How far each group mean is from the overall mean, weighted by group sizek − 1
Within groups (also called “error” or “residual”)SSW = ΣΣ(x − x̄ᵢ)² = Σ(nᵢ − 1)sᵢ²How far each value is from its own group mean: the noise ANOVA compares againstN − k
TotalSST = ΣΣ(x − x̄)²How far each value is from the overall meanN − 1

Swipe the table sideways to see every column.

Here k is the number of groups, N is the total number of observations, nᵢ, x̄ᵢ and sᵢ are the size, mean and standard deviation of group i, and x̄ is the overall (grand) mean. The second form of SSW, Σ(nᵢ − 1)sᵢ², is the shortcut when a problem gives you summary statistics instead of raw data.

Why does this work? Each mean square estimates the same population variance σ² when H₀ is true. MS within estimates σ² no matter what. MS between only estimates σ² if the population means are equal; if they aren’t, it runs bigger. So their ratio hovers around 1 under H₀ and grows when H₀ is false.

The ANOVA table, cell by cell

Software and exams report ANOVA in the same table. Each cell comes from the one before it, so if you know the recipe you can fill in any missing piece.

How each cell of a one-way ANOVA table is computed
SourcedfSSMS = SS ÷ dfFp-value
Betweenk − 1SSBMSB = SSB ÷ (k − 1)MSB ÷ MSWP(F ≥ observed)
WithinN − kSSWMSW = SSW ÷ (N − k)
TotalN − 1SST

Swipe the table sideways to see every column.

Two checks catch most arithmetic slips: the df column adds up (k − 1 + N − k = N − 1), and the SS column adds up (SSB + SSW = SST). The MS column does not add up, and the Total row has no mean square.

Three worked examples

Example 1: From raw data (study methods)

Twelve students are randomly assigned to one of three study methods, then take the same 20-point quiz. Test at α = 0.05 whether the mean score differs by method.

Quiz scores (out of 20) by study method
MethodScoresMeanΣ(x − x̄ᵢ)²
Flashcards12, 14, 11, 15131 + 1 + 4 + 4 = 10
Practice problems17, 18, 15, 18170 + 1 + 4 + 1 = 6
Rereading notes13, 12, 9, 14121 + 0 + 9 + 4 = 14

Swipe the table sideways to see every column.

  1. Hypotheses: H₀: μ₁ = μ₂ = μ₃. Hₐ: at least one method’s mean differs.
  2. Grand mean: all 12 scores add to 168, so x̄ = 168 ÷ 12 = 14.
  3. SS between: 4(13 − 14)² + 4(17 − 14)² + 4(12 − 14)² = 4 + 36 + 16 = 56.
  4. SS within: add the last column: 10 + 6 + 14 = 30. (Check: SS total, computed from every score’s distance to 14, is 86 = 56 + 30.)
  5. Mean squares: df between = 3 − 1 = 2, df within = 12 − 3 = 9. MSB = 56 ÷ 2 = 28. MSW = 30 ÷ 9 ≈ 3.33.
  6. F and p: F = 28 ÷ (30 ÷ 9) = 8.40 on (2, 9) df (use the unrounded MSW here; dividing by the rounded 3.33 would give 8.41). The p-value is P(F ≥ 8.40) ≈ 0.0087. (The α = 0.05 critical value is about 4.26, and 8.40 is well past it.)
  7. Conclusion: 0.0087 ≤ 0.05, so reject H₀. There is convincing evidence that mean quiz score is not the same for all three study methods.

Practice problems has the highest sample mean, but the F test alone doesn’t prove it beats both others. A follow-up comparison (such as Tukey’s HSD) is how you’d check that.

Example 2: From summary statistics (a result that isn’t significant)

A psychology lab measures reaction time in milliseconds for 30 volunteers randomly assigned to no caffeine, a low dose or a high dose (10 per group).

Reaction time summary by caffeine dose
DosenMean (ms)SD (ms)
None1028530
Low1027028
High1026232

Swipe the table sideways to see every column.

  1. Grand mean: the groups are the same size, so x̄ = (285 + 270 + 262) ÷ 3 = 817/3 ≈ 272.33. Keep the exact 817/3 for the next step so rounding doesn't creep in.
  2. SS between: 10[(285 − 817/3)² + (270 − 817/3)² + (262 − 817/3)²] = 10[(38/3)² + (−7/3)² + (−31/3)²] = 10 × 818/3 = 8180/3 ≈ 2,726.7.
  3. SS within, using the shortcut: Σ(nᵢ − 1)sᵢ² = 9(30² + 28² + 32²) = 9(900 + 784 + 1,024) = 24,372.
  4. Mean squares: MSB = (8180/3) ÷ 2 = 4090/3 ≈ 1,363.3. MSW = 24,372 ÷ 27 ≈ 902.7.
  5. F and p: F = 1,363.3 ÷ 902.7 ≈ 1.51 on (2, 27) df, p ≈ 0.24.
  6. Conclusion: 0.24 > 0.05, so fail to reject H₀. These data are not convincing evidence that mean reaction time differs by caffeine dose.

The sample means differ by up to 23 ms, which sounds like a lot. But people within each group vary by about 30 ms, so gaps that size are easy to get by chance with 10 people per group. It’s the same lesson as the explorer with the spread turned up. And as always, “fail to reject” isn’t proof that caffeine does nothing; a bigger study might detect an effect.

Example 3: Finish a software table and interpret it

Forty students are randomly split among four tutoring formats, and their improvement on a weekly quiz is recorded. The software output came back with blanks:

Partial ANOVA output for four tutoring formats
SourcedfSSMSFp
Format354.0???
Error?216.0?
Total39270.0

Swipe the table sideways to see every column.

  1. df error: 39 − 3 = 36 (also N − k = 40 − 4).
  2. Mean squares: MS format = 54.0 ÷ 3 = 18.0. MS error = 216.0 ÷ 36 = 6.0.
  3. F: 18.0 ÷ 6.0 = 3.00 on (3, 36) df.
  4. p: P(F ≥ 3.00) ≈ 0.043.
  5. Interpret the p-value: if all four tutoring formats produced the same mean improvement, an F statistic of 3.00 or larger would happen only about 4.3% of the time.
  6. Decide: at α = 0.05, reject H₀: at least one format’s mean improvement differs. At α = 0.01 you would not reject. Report it as F(3, 36) = 3.00, p = 0.043.

Reading the p-value in an ANOVA

The p-value means the same thing it always does (see P-value explained, with practice), but ANOVA adds two twists.

Only large F counts as extreme. Unequal means push F up, never down, so the p-value is always the area in the right tail of the F distribution: P(F ≥ your F). You never double it. An F near or below 1 simply means the group means don’t vary more than the noise would predict.

Rejecting H₀ is a vague win. It tells you the means are not all equal, and that’s it. Use this sentence and fill in the context:

If all [k] population means were equal, there would be about a [p as a percent] chance of getting an F statistic of [your F] or larger.

What you can conclude after a small p-value: at least one population mean differs. What you can’t conclude without more work: which group is different, that every group differs, or that the difference is large enough to matter. For “which,” courses use a follow-up method such as Tukey’s HSD or Bonferroni-adjusted pairwise tests. For “how big,” look at the group means themselves or an effect size such as η² = SSB ÷ SST (in Example 1, 56 ÷ 86 ≈ 0.65).

ANOVA or t test?

Both compare means of a quantitative variable. The choice comes down to how many groups you have and whether they are independent.

Choosing between t tests and one-way ANOVA
Your setupUseWhy
One group vs a claimed valueOne-sample t testOnly one mean to test
Same subjects measured twice (before and after, matched pairs)Paired t testWork with the differences; the groups aren’t independent
Two independent groupsTwo-sample t testHandles one-sided questions and gives a confidence interval for the difference
Three or more independent groupsOne-way ANOVAOne test for all the means at once, with the false-positive rate held at α

Swipe the table sideways to see every column.

Why not just run a t test on every pair? With 3 groups there are 3 pairs; with 4 groups, 6 pairs. Each test at α = 0.05 has a 5% chance of a false positive, and they pile up. Treating the tests as independent, the chance of at least one false alarm when every mean is truly equal is 1 − 0.95³ ≈ 0.14 for 3 groups and 1 − 0.95⁶ ≈ 0.26 for 4 groups. ANOVA runs a single test, so the overall rate stays at 5%.

With exactly two groups they agree. One-way ANOVA on two groups gives F = t², where t is the pooled two-sample t statistic, and the same p-value as the two-sided t test. For the two-group case in depth, see Two-sample t test practice; for tests beyond means, see Which statistical test should I use?

Conditions to check before you trust the F test

  • Independence: random samples from each population, or random assignment to groups, and no subject counted twice. (Same people in every group? That’s repeated measures, not one-way ANOVA.)
  • Roughly normal data in each group: check dot plots or boxplots for strong skew or outliers. ANOVA tolerates mild non-normality, especially with larger groups of similar size.
  • Similar spreads: a common rule of thumb is largest sample SD ÷ smallest sample SD ≤ 2. In Example 2 it is 32 ÷ 28 ≈ 1.14, which is fine.

The response must be numerical and the factor that defines the groups must be categorical. If the response is categorical (pass/fail, yes/no), you are in chi-square territory instead.

Practice: ten ANOVA problems

Pick or type an answer and check it. You can retry as often as you like or open the full solution. Question 8 asks you to fill in five cells of an ANOVA table. On number questions, press Enter to check.

1. A researcher compares mean exam scores in four course sections that each used a different textbook. Which alternative hypothesis fits a one-way ANOVA?
Show solution 1

Hₐ: at least one population mean differs from the others. H₀: μ₁ = μ₂ = μ₃ = μ₄. The alternative is the plain opposite of “all equal.” It does not say which mean differs, or that all of them do.

2. A one-way ANOVA compares 5 groups with 8 people in each group. What are the within-groups (denominator) degrees of freedom?

Show solution 2

35. N = 5 × 8 = 40, so df within = N − k = 40 − 5 = 35. (Same thing: each group contributes n − 1 = 7, and 5 × 7 = 35.) Between-groups df = k − 1 = 4, and total df = N − 1 = 39 = 4 + 35.

3. A one-way ANOVA has 3 groups and 33 people in total. SS between = 48 and SS within = 180. What is the F statistic? Round to 2 decimal places.

Show solution 3

F = 4.00. df between = 3 − 1 = 2, df within = 33 − 3 = 30. MS between = 48 ÷ 2 = 24. MS within = 180 ÷ 30 = 6. F = 24 ÷ 6 = 4.00 on (2, 30) df, which gives p ≈ 0.029.

4. An ANOVA comparing mean anxiety scores for three types of therapy gives F(2, 57) = 6.71, p = 0.002. Which statement is justified at α = 0.05?
Show solution 4

At least one mean differs; a follow-up test says which. Interpretation of the p-value: if all three therapies had the same mean, an F statistic of 6.71 or larger would happen only about 0.2% of the time. That is strong evidence against “all equal,” but it doesn’t point at a particular therapy.

5. Which situation produces the largest F statistic?
Show solution 5

Far-apart means with tight groups. The numerator measures how much the group means vary; the denominator measures the noise inside each group. Try it in the spread explorer: move the means apart and shrink the spread, and F climbs fast.

6. Which study calls for a one-way ANOVA rather than a t test or chi-square test?
Show solution 6

Battery life across four brands. One numerical response, one categorical factor with 4 levels, independent groups. See ANOVA or t test? for the full comparison.

7. With 5 groups, testing every pair takes 10 separate t tests at α = 0.05. If all 5 population means are truly equal and you treat the tests as independent, what is the chance of at least one false positive? Round to 2 decimal places.

Show solution 7

About 0.40. 1 − 0.95¹⁰ = 1 − 0.5987 ≈ 0.40. Pairwise t tests on the same data aren’t truly independent, so this is an approximation, but the point stands: a 40% false-alarm rate is far above 5%. That’s why you run one ANOVA first.

8. Complete the ANOVA table. Three groups, 24 students in total, SS between = 60 and SS within = 105. Type each missing value.

Show solution 8

df between = 2, df within = 21, MS between = 30, MS within = 5, F = 6.00. Each mean square is its SS divided by its df. F(2, 21) = 6.00 gives p ≈ 0.009, so at α = 0.05 you would reject H₀.

9. Three groups have sample standard deviations 4.1, 5.0 and 9.8, with group sizes 12, 15 and 11. Is the equal-spread condition for ANOVA reasonable?
Show solution 9

Not really. 9.8 ÷ 4.1 ≈ 2.39, above the rough cutoff of 2. ANOVA is fairly forgiving when group sizes are equal, but these sizes differ, so it is worth flagging. Options include Welch’s ANOVA or a rank-based test, depending on your course.

10. With only two groups, a pooled two-sample t test gives t = −2.40. What F statistic would a one-way ANOVA give on the same data?

Show solution 10

F = 5.76. With two groups, F = t² for the pooled t test, and the F test’s p-value equals the two-sided t test’s p-value. That’s why ANOVA is “the t test for more than two groups.”

Frequently asked questions

What is ANOVA in simple terms?

One-way ANOVA (analysis of variance) tests whether three or more group means are all equal. It compares how far apart the group means are with how spread out the data are inside each group. If the means are far apart compared with that spread, the F statistic is large and the p-value is small.

Why is it called analysis of variance if it compares means?

Because it splits the total variation in the data into two parts: variation between the group means and variation within the groups. Comparing those two variance estimates tells you whether the means differ by more than chance alone would explain.

What does a significant ANOVA result tell you?

That at least one population mean differs from the others. It does not tell you which one, or how many. To find out which groups differ, use a follow-up method such as Tukey’s HSD or Bonferroni-adjusted comparisons.

Can you use ANOVA with only two groups?

Yes. With two groups, one-way ANOVA gives exactly the same p-value as the pooled two-sample t test, and F equals t squared. Most courses use the t test for two groups because it can also be one-sided and gives a confidence interval for the difference directly.

What does it mean if F is less than 1?

The group means vary less than you would expect from the spread within groups alone. That is no evidence against H₀, so you fail to reject it. F can never be negative, because it is a ratio of two variances.

What are the conditions for one-way ANOVA?

Independent random samples (or random assignment to groups), a roughly normal response in each group, and similar standard deviations across groups. A common rule of thumb is that the largest sample standard deviation should be no more than about twice the smallest.

Keep practicing

Try 3 days free

3-day free trial, no card needed.

Related guides

Sources and fact checks

Formulas, conditions and interpretation rules were checked against these references. Every number on this page was recomputed: sums of squares by hand and in code, and p-values from the F distribution. The quiz, reaction-time and tutoring data are made up for teaching.