Parameters
Enter one group per line. Within each line, separate the observations with commas, spaces or semicolons, and use a decimal point for decimals.
Write one group per line (at least two groups), separating the observations on each line with commas, spaces or semicolons; each group needs at least two observations. The sample data are those of the worked example below.
Probability of wrongly rejecting \(H_0\) when it is actually true. The usual value is 0.05.
F distribution, rejection region and observed F
What is one-way ANOVA?
One-way analysis of variance (ANOVA) tests whether three or more independent populations have the same mean. It is the natural extension of the two-means test when there are more groups: do three fertilisers give the same yield? Do four suppliers take the same time to deliver an order? Do students using five study methods score the same? The "factor" is the variable that defines the groups (the fertiliser, the supplier, the method), and each value of the factor is a level or treatment.
The null hypothesis is that all the means are equal; the alternative, that at least one is different:
\(H_0: \mu_1 = \mu_2 = \cdots = \mu_k\)
\(H_1\): not all \(\mu_j\) are equal
ANOVA does not say which mean or means differ, nor in which direction: it is a global question. To find out which pairs of groups differ, it is followed by post hoc comparisons.
Why not run several t-tests?
With three groups you would need 3 pairwise comparisons; with five, 10. Each carries a 5% risk of a false positive, and the risks add up: with 10 independent comparisons, the probability of finding at least one "significant" difference by pure chance is around 40%. ANOVA answers the global question with a single test that keeps that risk at \(\alpha\).
The idea: comparing two sources of variability
Although its aim is to compare means, ANOVA does so by comparing variances, hence its name. The total variability of the data is split into two parts:
- Between-group variability: how far the group means are from the overall mean. It reflects the effect of the factor, plus noise.
- Within-group variability: how spread out the data are around the mean of their own group. It is the noise, the variability the factor does not explain.
If \(H_0\) is true, the group means differ only by chance, and both sources estimate the same variance: their ratio should be around 1. If the factor has an effect, the means spread out more than the noise explains, and the between-group variability grows.
\(SS_{T} = SS_{\text{between}} + SS_{\text{within}}\)
\(SS_{\text{between}} = \sum_{j=1}^{k} n_j(\bar{x}_j - \bar{x})^2, \qquad SS_{\text{within}} = \sum_{j=1}^{k}\sum_{i=1}^{n_j}(x_{ij} - \bar{x}_j)^2\)
\(F = \dfrac{MS_{\text{between}}}{MS_{\text{within}}} = \dfrac{SS_{\text{between}}/(k-1)}{SS_{\text{within}}/(N-k)}\)
Here \(k\) is the number of groups, \(n_j\) the size of group \(j\), \(N\) the total number of observations, \(\bar{x}_j\) the mean of group \(j\) and \(\bar{x}\) the overall mean. The mean squares (MS) are the sums of squares divided by their degrees of freedom. Under \(H_0\), the statistic follows Snedecor's F distribution with \(k-1\) and \(N-k\) degrees of freedom (you can look up its critical values in the F table). The test is always right-tailed: only a large F is evidence against \(H_0\).
The ANOVA table
The results are presented in a table with one row per source of variability. The calculator includes it under "Calculation details":
| Source | SS | df | MS | F |
|---|---|---|---|---|
| Between groups | \(SS_{\text{between}}\) | \(k-1\) | \(SS_{\text{between}}/(k-1)\) | \(MS_{\text{between}}/MS_{\text{within}}\) |
| Within groups | \(SS_{\text{within}}\) | \(N-k\) | \(SS_{\text{within}}/(N-k)\) | |
| Total | \(SS_T\) | \(N-1\) |
\(MS_{\text{within}}\) is the pooled variance of all the groups: it estimates the common variance \(\sigma^2\) whether or not \(H_0\) is true.
Assumptions of ANOVA
- Independence: groups independent of each other and observations independent within each group. If the same subjects go through all the conditions, you need a repeated-measures ANOVA.
- Approximate normality of the data in each group (or of the residuals). With moderately sized groups of similar size, ANOVA is quite robust to mild departures.
- Homogeneity of variances: the group variances should be similar. This is the most delicate assumption when the groups have different sizes.
A rule of thumb: if the largest standard deviation is less than twice the smallest and the groups have similar sizes, classic ANOVA works well. If not, use Welch's ANOVA, which does not assume equal variances; if the data are very skewed or there are outliers with small groups, the non-parametric alternative is the Kruskal-Wallis test. The calculator shows the standard deviation of each group under "Calculation details" so you can check this, and you can check normality with the Shapiro-Wilk test.
Worked example
An agronomist evaluates the effect of three fertilisers on the yield (kg) of farm plots. Five plots are randomly assigned to each fertiliser, with these results:
| Fertiliser | Yields (kg) | Mean | Variance |
|---|---|---|---|
| A | 32, 34, 31, 33, 35 | 33 | 2.5 |
| B | 28, 30, 27, 29, 31 | 29 | 2.5 |
| C | 36, 38, 35, 37, 39 | 37 | 2.5 |
We test \(H_0: \mu_A = \mu_B = \mu_C\) with \(\alpha = 0.05\). The overall mean is \(\bar{x} = 33\) kg. The between-group sum of squares is
\( SS_{\text{between}} = 5\left[(33-33)^2 + (29-33)^2 + (37-33)^2\right] = 5(0 + 16 + 16) = 160 \)
and, since each group has variance 2.5 with 4 degrees of freedom, the within-group sum of squares is \(SS_{\text{within}} = 3 \times 4 \times 2.5 = 30\). With \(df_{\text{between}} = 2\) and \(df_{\text{within}} = 15 - 3 = 12\):
\( MS_{\text{between}} = \dfrac{160}{2} = 80, \qquad MS_{\text{within}} = \dfrac{30}{12} = 2.5, \qquad F = \dfrac{80}{2.5} = 32 \)
The critical value is \(F_{0.05;\,2,\,12} \approx 3.89\) and the p-value is \(p \approx 0.000015\). Since \(F = 32\) far exceeds the critical value, \(H_0\) is rejected: there is evidence that not all fertilisers give the same mean yield.
The effect size is huge: \(\eta^2 = 160/190 \approx 0.84\), meaning that the fertiliser explains 84% of the variability in yield across these plots. To find out which fertilisers differ from each other, the next step is a post hoc comparison. Note also that, with only 5 plots per group, ANOVA detects with 80% probability only very large effects (f ≈ 0.91): it worked here because the real effect is enormous, but moderate effects would need many more plots.
In the calculator: these are the sample data shown when the page loads.
How to interpret the result
Rejecting \(H_0\) (p-value < α) indicates that at least one mean differs from the others, but not which one or in which direction. Look at the mean of each group and apply a post hoc comparison. Remember too that significant is not the same as important: with large groups, small differences between means give a significant F.
Not rejecting \(H_0\) (p-value ≥ α) does not prove that the means are equal: the data are compatible with equality, but the study may not have had enough power. Few observations per group or high within-group variability prevent real differences from being detected.
The F statistic compares the variability between groups with the variability within them. An F close to 1 indicates that the means are as far apart as chance would lead you to expect; the larger it is, the more evidence that the factor has an influence. On the chart, the green area is the non-rejection region, the red area is the critical tail and the amber line marks the observed F.
Effect size: η² and Cohen's f
\(\eta^2 = SS_{\text{between}}/SS_T\) is the proportion of the total variability explained by the factor. As a rough guide, 0.01 is a small effect, 0.06 medium and 0.14 large. With small samples, \(\eta^2\) tends to overestimate the real effect; omega squared (\(\omega^2\)) corrects that bias.
Power and sample size calculations use Cohen's f, obtained from \(\eta^2\) as \(f = \sqrt{\eta^2/(1-\eta^2)}\), which measures how far apart the group means are in units of the within-group standard deviation. Cohen's benchmarks are 0.10 (small), 0.25 (medium) and 0.40 (large).
Power and minimum detectable effect
Below the conclusion, the calculator shows the minimum detectable effect size: the smallest Cohen's f that, with your group sizes, ANOVA would detect with 80% probability. If it is larger than the effect that would matter to you, a non-significant result says little. For reference, with 3 groups of 20 observations only large effects (f ≈ 0.41) are detected with that probability, and medium effects (f = 0.25) require about 53 observations per group. The link in the result opens the sample size calculator for ANOVA with your number of groups and your α, so you can work out the size needed for the effect you care about.
After a significant ANOVA: post hoc comparisons
If ANOVA rejects \(H_0\), post hoc comparisons show which pairs of groups differ, controlling the accumulated risk of false positives:
- Tukey (HSD): compares every pair with every other. It is the usual choice when there are no prior hypotheses.
- Bonferroni: runs t-tests using \(\alpha\) divided by the number of comparisons. It is simple and suitable if you are only interested in a few comparisons.
- Dunnett: compares each treatment only with a control group.
- Games-Howell: like Tukey, but without assuming equal variances.
In the fertiliser example, all three differences (C − A = 4, A − B = 4 and C − B = 8 kg) are significant with Tukey's test.
Common mistakes
- Running every pairwise t-test instead of an ANOVA followed by post hoc comparisons.
- Reading a significant ANOVA as "all the means are different": one differing mean is enough.
- Concluding that the means are equal because the ANOVA is not significant.
- Applying it to repeated measures of the same subjects, which are not independent groups.
- Ignoring very different variances when the groups have different sizes: in that case, use Welch's ANOVA.
- Reporting only the p-value, without the group means or the effect size.
Frequently asked questions
- What does one-way ANOVA test? Whether the means of three or more independent groups are equal. The alternative hypothesis is that at least one mean differs from the others.
- Does ANOVA prove that all the means are different? No. A significant result only indicates that at least one mean differs. To find out which, apply post hoc comparisons such as Tukey's test.
- Can I use ANOVA with only two groups? Yes, and it is equivalent to the t-test with equal variances (F = t²). Even so, for two groups the two-means test is more direct, and it also allows one-tailed tests.
- Why not run several pairwise t-tests? Because the risk of some false positive grows with each comparison. With 10 comparisons at α = 0.05, the probability of at least one false difference is around 40%.
- What does η² mean? The proportion of the total variability explained by group membership. As a rough guide, 0.01 is a small effect, 0.06 medium and 0.14 large.
- What are the assumptions of ANOVA? Independence, approximate normality in each group and similar variances. If the variances differ a lot, use Welch's ANOVA; if the data are very skewed and there are few of them, the Kruskal-Wallis test.
- Can the groups have different sizes? Yes. One-way ANOVA works with unequal groups, although it then becomes more sensitive to unequal variances.
- What is the minimum detectable effect in ANOVA? The smallest effect size, measured with Cohen's f, that ANOVA would detect with 80% probability given your group sizes. If the real effect is smaller, ANOVA will probably not detect it.
- How many observations per group do I need? It depends on the effect size you want to detect and the desired power. For a medium effect (f = 0.25) with 3 groups, α = 0.05 and 80% power, about 53 per group. Work it out with the sample size calculator for ANOVA.
Reference: One-way analysis of variance — Wikipedia