A one-way ANOVA (one-way analysis of variance) is a statistical test that compares the means of three or more independent groups to decide whether at least one group mean differs significantly from the others. It uses a single categorical independent variable (the factor, with three or more levels) and one quantitative dependent variable, and it answers a simple question: are the differences between the group averages larger than you would expect from random chance alone?
The test works by partitioning the total variability in the data into two parts — the variation between the groups and the variation within the groups — and comparing them with an F-test. If between-group variation is large relative to within-group variation, the means are probably genuinely different. This guide explains the hypotheses, the F-ratio, the assumptions, and a full worked example with an ANOVA table and Tukey post-hoc test. For the broader family of methods, see our overview of everything you need to know about ANOVA, and for two factors see our beginner’s guide to two-way ANOVA.
“Analysis of variance (ANOVA) is a collection of statistical models used to analyze the differences among group means in a sample.” — The term and method are attributed to statistician Ronald A. Fisher (1918, 1925)
What Is a One-Way ANOVA Used For?
A one-way ANOVA has one categorical independent variable with at least three levels (groups or categories) and one quantitative dependent variable. It is used to measure the effect of that single factor on the outcome. Typical research questions include:
- Social media and sleep: the independent variable is social-media usage, split into low, medium and high groups, and you test whether nightly sleep duration differs between them.
- Brand and price: the independent variable is soft-drink brand, and you collect the price per 100 ml for Coke, Sprite and Fanta to see whether mean price differs.
- Fertiliser and yield: the independent variable is fertiliser type (Mixtures 1, 2 and 3) applied to cropping fields to decide whether mean crop yield differs.
When you have only two groups to compare, you would use an independent-samples t-test instead. The one-way ANOVA is essentially the extension of the t-test to three or more groups. Unsure which test fits your data? See our guide on which statistical test you should use.
One-Way ANOVA Hypotheses
The one-way ANOVA tests two competing hypotheses about the population means of the k groups:
- Null hypothesis (H0): all group means are equal — μ1 = μ2 = … = μk. The factor has no effect on the dependent variable.
- Alternative hypothesis (Ha): at least one group mean differs from the others. (It does not claim that all means differ — only that they are not all the same.)
Because ANOVA is an inferential test, a significant result tells you that a difference exists somewhere, but not which groups differ. To find that out you follow up with a post-hoc test such as Tukey’s HSD (covered below). For more on the decision rule, read about statistical significance and the p-value.
How the ANOVA Test Works: The F-Ratio
ANOVA decides whether the levels of the independent variable produce genuinely different group means by comparing two estimates of variance. It does this with an F-test, which allows all groups to be compared at once while controlling the overall error rate — a single comparison across the whole set rather than many separate pairwise tests.
The F-statistic is the ratio of two mean squares:
where MSbetween (the “between-groups” mean square) measures how far the group means spread out around the overall (grand) mean, and MSwithin (the “within-groups” or error mean square) measures the average variability of individual scores around their own group mean.
Each mean square is a sum of squares divided by its degrees of freedom:
- MSbetween = SSbetween / (k − 1), where k is the number of groups.
- MSwithin = SSwithin / (N − k), where N is the total number of observations.
The logic is straightforward. If the group means are all similar, the between-groups variation will be about the same size as the within-groups variation, so F will be close to 1. If the factor really does shift the means apart, between-groups variation grows while within-groups variation stays the same, so F becomes large. A large F (and a correspondingly small p-value) is evidence against the null hypothesis. You then compare your F-statistic to a critical value from the F-distribution, using k − 1 and N − k degrees of freedom, or simply read off the p-value.
ANOVA partitions total variance
- Variation due to the treatment / factor
- Random error inside each group
One-Way ANOVA Assumptions
The one-way ANOVA is a parametric test, so its conclusions are only trustworthy when these assumptions hold:
- Independence of observations. The data must be collected so that one observation gives no information about another — no repeated measurements of the same subject across groups, and no clustering. If observations are linked, a repeated-measures ANOVA or a model with blocking variables is more appropriate. Good data collection design protects this assumption.
- Normality of the dependent variable. The dependent variable should be approximately normally distributed within each group. ANOVA is fairly robust to mild departures, especially with larger and roughly equal sample sizes.
- Homogeneity of variance. The variance of the dependent variable should be roughly equal across all groups (often checked with Levene’s test). When variances differ markedly, a Welch’s ANOVA is a safer alternative.
The dependent variable should also be measured on an interval or ratio scale. If you are unsure about your variable types, review the levels of measurement.
Struggling to run or interpret your ANOVA?
ResearchProspect to the rescue!
Our statisticians can run, check and write up your analysis — explore our statistical analysis service.
Worked Example: Calculating a One-Way ANOVA Step by Step
Let’s work through a small, fully numerical example by hand so you can see exactly where every value in an ANOVA table comes from. Suppose the crop scientist measures the yield (in arbitrary units) of five plots under each of three fertilisers.
| Fertiliser 1 | Fertiliser 2 | Fertiliser 3 |
|---|---|---|
| 8 | 10 | 14 |
| 9 | 11 | 13 |
| 7 | 12 | 15 |
| 8 | 10 | 14 |
| 8 | 12 | 14 |
| Mean = 8 | Mean = 11 | Mean = 14 |
Here k = 3 groups and N = 15 observations. The grand mean (average of all 15 values) is (40 + 55 + 70) / 15 = 11.
Step 1 – Between-groups sum of squares (SSbetween). Multiply each group’s squared deviation from the grand mean by its sample size (n = 5):
SSbetween = 5×(8−11)² + 5×(11−11)² + 5×(14−11)² = 5(9) + 5(0) + 5(9) = 90.
Step 2 – Within-groups sum of squares (SSwithin). Add up each value’s squared deviation from its own group mean.
Fertiliser 1: (8−8)²+(9−8)²+(7−8)²+(8−8)²+(8−8)² = 2.
Fertiliser 2: (10−11)²+(11−11)²+(12−11)²+(10−11)²+(12−11)² = 4.
Fertiliser 3: (14−14)²+(13−14)²+(15−14)²+(14−14)²+(14−14)² = 2.
SSwithin = 2 + 4 + 2 = 8.
Step 3 – Degrees of freedom. dfbetween = k−1 = 2; dfwithin = N−k = 15−3 = 12.
Step 4 – Mean squares. MSbetween = 90/2 = 45; MSwithin = 8/12 = 0.667.
Step 5 – F-statistic. F = MSbetween / MSwithin = 45 / 0.667 = 67.5.
With df = (2, 12), the critical F at α = 0.05 is about 3.89. Since 67.5 > 3.89 (p < 0.001), we reject H0: at least one fertiliser produces a different mean yield.
By hand this is manageable for a tiny dataset, but with realistic sample sizes you would use software such as R, SPSS, Excel or Python. For a software walkthrough see our guide to conducting ANOVA.
Reading the ANOVA Summary Table
Whatever software you use, the output is organised as an ANOVA table. Using the worked example above, it looks like this:
| Source | Df | Sum Sq (SS) | Mean Sq (MS) | F value | Pr(>F) |
|---|---|---|---|---|---|
| Fertiliser (between) | 2 | 90.0 | 45.0 | 67.5 | < 0.001 |
| Residuals (within) | 12 | 8.0 | 0.667 | — | — |
Each column has a specific meaning:
- Df – degrees of freedom: k−1 for the factor and N−k for the residuals.
- Sum Sq – the sum of squares, i.e. the total variation attributed to the factor (between) and to error (within/residual).
- Mean Sq – the sum of squares divided by its degrees of freedom.
- F value – the between-groups mean square divided by the within-groups mean square. A larger F means the between-group differences are large relative to the noise.
- Pr(>F) – the p-value: the probability of obtaining an F this large if the null hypothesis were true.
The decision rule is simple: if the p-value is less than your significance level (usually 0.05), you reject the null hypothesis and conclude the factor has a statistically significant effect. In our example p < 0.001, so fertiliser type significantly affects mean crop yield.
Post-Hoc Testing with Tukey’s HSD
A significant ANOVA tells you that at least one group differs, but not which pairs differ. To answer that, you run a post-hoc test — most commonly Tukey’s Honestly Significant Difference (HSD). Tukey’s test compares every pair of group means while controlling the family-wise error rate, so the chance of a false positive does not balloon as you add comparisons.
For each pair, Tukey’s HSD reports the difference in means (diff), the lower and upper bounds of the 95% confidence interval (lwr and upr), and an adjusted p-value (p adj). A pair is significantly different if its confidence interval does not include zero. Applied to our worked example, the comparisons would look like this:
| Comparison | diff | 95% CI (lwr, upr) | p adj | Significant? |
|---|---|---|---|---|
| Fert 2 − Fert 1 | +3.0 | (1.7, 4.3) | < 0.001 | Yes |
| Fert 3 − Fert 1 | +6.0 | (4.7, 7.3) | < 0.001 | Yes |
| Fert 3 − Fert 2 | +3.0 | (1.7, 4.3) | < 0.001 | Yes |
Here every pair differs significantly, with Fertiliser 3 producing the highest yields. In a different dataset you might find, say, that Fertiliser 3 beats both 1 and 2 while 1 and 2 are statistically indistinguishable from each other — the post-hoc test is what pins down that detail.
Reporting One-Way ANOVA Results
When you write up a one-way ANOVA — for a dissertation, journal article or report — include the following:
- a brief description of the variables and groups;
- the F-value with its two degrees of freedom, written F(dfbetween, dfwithin);
- the p-value;
- the direction and size of the effect; and
- the results of any post-hoc comparisons.
For example, in APA style: “A one-way ANOVA revealed a statistically significant difference in mean crop yield between the three fertiliser types, F(2, 12) = 67.5, p < .001. A Tukey HSD post-hoc test showed that Fertiliser 3 produced significantly higher yields than both Fertiliser 1 (mean difference = 6.0, p < .001) and Fertiliser 2 (mean difference = 3.0, p < .001).”