Tutorials › Introduction to Statistics › A Complete One-Way ANOVA Problem Workshop

One-Way ANOVA · Tutorial 871 of 996

A Complete One-Way ANOVA Problem Workshop

Follow a complete one-way ANOVA workflow and learn to connect each calculation to the question it answers.

Intermediate 11 min read

What You'll Learn

  • State the research question and hypotheses for a one-way ANOVA.
  • Check the assumptions needed for an exact F test.
  • Calculate between-group, within-group, and total sums of squares.
  • Build an ANOVA table with the correct degrees of freedom and mean squares.
  • Use the F statistic and p-value to make a decision at a stated significance level.
  • Write a contextual conclusion without claiming that the test identifies which groups differ.

From a Question to an ANOVA Conclusion

A one-way ANOVA problem is more than a calculation of an F statistic. A complete analysis connects a question about several population means to hypotheses, a model, an ANOVA table, a decision, and a conclusion in context. Keeping those steps together helps prevent a correct calculation from being given an incorrect interpretation.

This workshop follows that full sequence in three hypothetical examples. In each, one categorical factor defines the groups, and one quantitative response is measured. The test asks whether the population means are all equal; it does not, by itself, name which means differ.

Model and assumptions: For group \(i\) and observation \(j\), write \(Y_{ij}=\mu_i+\varepsilon_{ij}\), where \(\mu_i\) is the population mean response in group \(i\). The one-way F test assumes independent errors, normally distributed errors with mean 0, and a common error variance \(\sigma^2\) across groups. Under the null hypothesis and these assumptions, the F statistic has an exact \(F\) distribution with \(k-1\) and \(N-k\) degrees of freedom, where \(k\) is the number of groups and \(N\) is the total sample size. If normality is only approximate, the F reference distribution and resulting p-value are approximate.

Independence is supported by the study design, not established by the arithmetic in the ANOVA table. The normal-error and common-variance assumptions describe the model for the responses around their group means. In the examples below, the hypothetical designs are stated to support independence, and the model assumptions are stipulated; a small data set alone cannot prove that they hold.

The Calculation Behind the Table

Let \(\bar{x}_i\) be the sample mean in group \(i\), and let \(\bar{x}\) be the grand mean of all \(N\) observations. ANOVA divides total variation into variation among the group means and variation within the groups.

Definitions: The between-groups sum of squares is \(SS_{\text{between}}=\sum_{i=1}^{k} n_i(\bar{x}_i-\bar{x})^2\). The within-groups sum of squares is \(SS_{\text{within}}=\sum_{i=1}^{k}\sum_{j=1}^{n_i}(x_{ij}-\bar{x}_i)^2\). The total sum of squares is \(SS_{\text{total}}=\sum_{i=1}^{k}\sum_{j=1}^{n_i}(x_{ij}-\bar{x})^2\). These satisfy \(SS_{\text{total}}=SS_{\text{between}}+SS_{\text{within}}\).

The degrees of freedom are \(k-1\) for between groups, \(N-k\) for within groups, and \(N-1\) for the total. Divide each sum of squares by its degrees of freedom to obtain the corresponding mean square. The test statistic is the ratio of the between-groups mean square to the within-groups mean square.

$$ MS_{\text{between}}=\frac{SS_{\text{between}}}{k-1}, \qquad MS_{\text{within}}=\frac{SS_{\text{within}}}{N-k}, \qquad F=\frac{MS_{\text{between}}}{MS_{\text{within}}} $$

The upper tail is used because a large F statistic means the observed differences among group means are large relative to the variation within groups. The p-value is the probability, under \(H_0\) and the model assumptions, of an F statistic at least as large as the one observed. It is not the probability that \(H_0\) is true.

Worked Through: Three Mixtures

Worked Example: A Balanced One-Way ANOVA From Raw Data

Question. In a hypothetical experiment, plants are randomly assigned to one of three nutrient mixtures. Their root lengths, in centimeters, are recorded. The data are Mixture 1: 7, 8, 9, 8; Mixture 2: 9, 10, 11, 10; Mixture 3: 11, 12, 13, 12. Is there evidence at \(\alpha=0.05\) that the population mean root lengths differ among the mixtures?

Hypotheses. With \(\mu_1,\mu_2,\mu_3\) denoting the population mean root lengths for the three mixtures, \(H_0:\mu_1=\mu_2=\mu_3\). The alternative is \(H_a:\) not all three population means are equal. This alternative does not assert that every pair of means differs.

Conditions. Random assignment supports independence of the plant responses across groups. For this worked example, assume the errors are normally distributed with a common variance in the three groups. Thus, under \(H_0\), the exact reference distribution is \(F(2,9)\).

Group and grand means. Each group has \(n_i=4\). The group means are \(\bar{x}_1=32/4=8\), \(\bar{x}_2=40/4=10\), and \(\bar{x}_3=48/4=12\) cm. The grand mean is \(\bar{x}=(32+40+48)/12=10\) cm.

Within-groups variation. In each group, the deviations from its own mean are \(-1,0,1,0\) cm, so the squared deviations sum to \(1+0+1+0=2\) cm². Therefore, \(SS_{\text{within}}=2+2+2=6\) cm².

Between-groups variation. The group means differ from the grand mean by \(-2,0,2\) cm. Thus,

$$ SS_{\text{between}} =4(8-10)^2+4(10-10)^2+4(12-10)^2 =16+0+16=32\ \text{cm}^2. $$

Check of the partition. Summing the squared deviations of every observation from the grand mean gives group contributions \(18\), \(2\), and \(18\) cm², respectively. Hence \(SS_{\text{total}}=18+2+18=38\) cm², which agrees with \(SS_{\text{between}}+SS_{\text{within}}=32+6=38\) cm².

Degrees of freedom and test statistic. Here \(k=3\), \(N=12\), so the between-groups, within-groups, and total degrees of freedom are \(2\), \(9\), and \(11\). The mean squares and F statistic are

$$ MS_{\text{between}}=\frac{32}{2}=16,\qquad MS_{\text{within}}=\frac{6}{9}=0.6667,\qquad F=\frac{16}{0.6667}=24.00. $$

Decision and conclusion. Under \(F(2,9)\), the upper-tail p-value for \(F=24.00\) is approximately \(0.000247\). Since \(0.000247<0.05\), reject \(H_0\). The hypothetical data provide strong evidence that the population mean root lengths are not all equal across the three nutrient mixtures. The omnibus test does not establish which mixture means differ.

SourceSum of squares (cm²)dfMean squareFp-value
Between groups3221624.000.000247
Within groups690.6667
Total3811

Why the Sums of Squares Add Up

The partition used above follows from splitting each observation’s deviation from the grand mean into two parts: its deviation from its own group mean, and the group mean’s deviation from the grand mean. For a particular observation, \(x_{ij}-\bar{x}=(x_{ij}-\bar{x}_i)+(\bar{x}_i-\bar{x})\). Squaring and summing over observations produces the within- and between-groups terms plus a cross-product term.

That cross-product is zero. Within each group, \(\sum_j(x_{ij}-\bar{x}_i)=0\), while \(\bar{x}_i-\bar{x}\) is constant for that group. Therefore,

$$ \begin{aligned} SS_{\text{total}} &=\sum_i\sum_j\left[(x_{ij}-\bar{x}_i)+(\bar{x}_i-\bar{x})\right]^2\\ &=SS_{\text{within}}+SS_{\text{between}} +2\sum_i(\bar{x}_i-\bar{x})\sum_j(x_{ij}-\bar{x}_i)\\ &=SS_{\text{within}}+SS_{\text{between}}. \end{aligned} $$

This identity is a useful arithmetic check: if the total does not equal the two components added together, revisit the calculations before interpreting the F statistic.

Unequal Group Sizes and a Significant Result

Worked Example: Unequal Group Sizes

Question and hypotheses. In a second hypothetical study, independent randomly assigned participants receive one of three brief training programs. Their task scores are Program A: 4, 5, 6; Program B: 6, 7, 8, 7; and Program C: 7, 8, 9. Is there evidence at \(\alpha=0.05\) that the population mean scores are not all equal? Let \(\mu_A,\mu_B,\mu_C\) be those population means. Test \(H_0:\mu_A=\mu_B=\mu_C\) against \(H_a:\) not all are equal.

Conditions. The stated random assignment supports independence. Assume normally distributed errors with a common variance across the programs. Under \(H_0\), use the exact \(F(2,7)\) reference distribution.

Means and sums of squares. The sample sizes are 3, 4, and 3; the group means are 5, 7, and 8. The grand mean is \(\bar{x}=(15+28+24)/10=6.7\). Each group has within-group squared deviations totaling 2, so \(SS_{\text{within}}=2+2+2=6\). For the between-groups component,

$$ SS_{\text{between}} =3(5-6.7)^2+4(7-6.7)^2+3(8-6.7)^2 =8.67+0.36+5.07=14.10. $$

Thus \(SS_{\text{total}}=14.10+6=20.10\). The degrees of freedom are \(2\), \(10-3=7\), and \(9\), respectively. Therefore \(MS_{\text{between}}=14.10/2=7.05\), \(MS_{\text{within}}=6/7=0.8571\), and \(F=7.05/0.8571=8.225\).

Decision and conclusion. The upper-tail p-value from \(F(2,7)\) is approximately \(0.0145\). Since \(0.0145<0.05\), reject \(H_0\). These hypothetical data provide evidence that the population mean task scores are not all equal among the three programs. The unequal sample sizes are handled by using each group’s own \(n_i\) in the between-groups sum of squares.

SourceSum of squaresdfMean squareFp-value
Between groups14.1027.058.2250.0145
Within groups6.0070.8571
Total20.109

A Nonsignificant Result Is Not Proof of Equality

Worked Example: A Result That Does Not Reach the Significance Level

Question and hypotheses. A third hypothetical comparison records measurements in units for three independent groups: Group A: 10, 11, 12; Group B: 11, 12, 13; Group C: 10, 11, 12. Test \(H_0:\mu_A=\mu_B=\mu_C\) against \(H_a:\) not all population means are equal, using \(\alpha=0.05\).

Conditions and calculations. Assume the study design makes observations independent and that errors are normally distributed with a common variance. The group means are 11, 12, and 11, and the grand mean is \(102/9=11.333\). Each group has within-group sum of squares 2, giving \(SS_{\text{within}}=6\). The between-groups sum of squares is

$$ SS_{\text{between}} =3(11-11.333)^2+3(12-11.333)^2+3(11-11.333)^2 =2.000. $$

Then \(SS_{\text{total}}=8.000\). The degrees of freedom are \(2\), \(6\), and \(8\); so \(MS_{\text{between}}=2/2=1\), \(MS_{\text{within}}=6/6=1\), and \(F=1/1=1.000\).

Decision and conclusion. For \(F(2,6)\), the upper-tail p-value is \(0.4219\). Since \(0.4219>0.05\), do not reject \(H_0\). These data do not provide sufficient evidence at the 0.05 level that the three population means differ. This is not proof that the means are equal: the test may not detect differences that are small relative to within-group variation or that the sample sizes cannot resolve.

SourceSum of squaresdfMean squareFp-value
Between groups2.00021.0001.0000.4219
Within groups6.00061.000
Total8.0008

A Reliable Problem-Solving Sequence

1
Translate the question.
Name the response, groups, and population means; state \(H_0\) and \(H_a\) in context.
2
State the model conditions.
Address independence, normal errors, and a common variance before using the exact F reference distribution.
3
Compute and check variation.
Find group means, the grand mean, both component sums of squares, and verify that they sum to the total.
4
Complete the table and test.
Use the correct degrees of freedom, divide to find mean squares, calculate F, and obtain its upper-tail p-value.
5
Decide and conclude.
Compare the p-value with \(\alpha\), then describe the evidence about the population means in the problem’s context.

Common Mistakes and Why the Workflow Matters

A frequent mistake is to read a significant omnibus F test as proof that every group differs from every other group. The test addresses the global null that all population means are equal. Rejecting it supports the conclusion that not all are equal, but does not identify the particular means responsible. Another mistake is to interpret a nonsignificant p-value as proof of equality; the correct conclusion is that the data did not provide sufficient evidence to reject the null at the chosen significance level.

Calculation errors can also change the decision. Use \(n_i\), not a common sample size unless the design is balanced, when calculating between-groups variation. Use \(N-k\), not \(N-1\), for the within-groups degrees of freedom. Finally, make the units clear: sums of squares have squared response units, while the F ratio is unitless because it divides two mean squares measured in the same squared units.

Key takeaway: A complete one-way ANOVA solution gives the hypotheses and assumptions, a checked partition of variation, a correctly constructed table, a p-value-based decision, and a conclusion limited to what the omnibus test establishes.

Check Your Understanding

Try these questions without looking back at the worked solutions.

  1. For a one-way ANOVA with four groups and \(N=28\) observations, what are the between-groups, within-groups, and total degrees of freedom?
  2. In a study comparing three population means, what does the alternative hypothesis “not all means are equal” assert—and what does it not assert?
  3. Why must independence be justified from the study design rather than inferred from a completed ANOVA table?
  4. If \(SS_{\text{between}}=18\), \(SS_{\text{within}}=42\), and there are three groups with \(N=24\), calculate \(MS_{\text{between}}\), \(MS_{\text{within}}\), and F.
  5. A test has p-value \(0.18\) and uses \(\alpha=0.05\). State the decision and explain why it does not prove that all population means are equal.