"> One-Way ANOVA: Test, Formula & Worked Example
Home > Library > Statistics > One-Way ANOVA: Hypotheses, F-Test and a Worked Example

Published by at August 20th, 2021 , Revised On June 16, 2026

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)

Example: A crop scientist wants to know whether three different fertiliser mixtures produce different crop yields. The fertiliser type (with three levels — Mixture 1, Mixture 2, Mixture 3) is the independent variable, and crop yield in bushels per hectare is the dependent variable. A one-way ANOVA tests whether the mean yield differs across the three fertilisers, rather than running three separate t-tests, which would inflate the error rate.

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:

F = MSbetween / MSwithin

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

Between-groups

  • Variation due to the treatment / factor
Within-groups

  • 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:

  1. 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.
  2. 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.
  3. 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.

Example — the calculation:

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).”

Frequently Asked Questions

What is a one-way ANOVA in simple terms?

A one-way ANOVA is a test that compares the average values of three or more separate groups to see whether at least one group differs significantly from the rest. It uses one categorical factor (for example, fertiliser type) and one numeric outcome (for example, crop yield), and decides whether the differences between the group means are bigger than would be expected from random variation alone.

A one-way ANOVA uses a single independent variable (one factor), whereas a two-way ANOVA uses two independent variables and can also test for an interaction between them — that is, whether the effect of one factor depends on the level of the other.

F = MSbetween / MSwithin. The between-groups mean square (MSbetween) is the between-groups sum of squares divided by k−1 degrees of freedom, and the within-groups mean square (MSwithin) is the within-groups sum of squares divided by N−k degrees of freedom, where k is the number of groups and N is the total sample size.

Use an independent-samples t-test when you are comparing exactly two group means. Use a one-way ANOVA when you have three or more groups. Running multiple t-tests instead of one ANOVA inflates the overall chance of a false-positive (Type I) error, which the ANOVA F-test avoids by testing all groups together.

A significant ANOVA (p < 0.05) tells you that at least one group mean differs from the others, but not which specific groups differ. To identify the differing pairs you run a post-hoc test such as Tukey’s HSD, which compares every pair of means while keeping the overall error rate under control.

The three core assumptions are: independence of observations, an approximately normal distribution of the dependent variable within each group, and homogeneity of variance (roughly equal variances across groups). The dependent variable should also be measured on an interval or ratio scale.

About Anastasia Lois

Avatar for Anastasia LoisLois is an academic writer and editor at ResearchProspect. A writer by day and a reader by night, She is loathed to discuss himself in the third person but can be persuaded to do so from time to time.

WhatsApp Live Chat