What does ANOVA test?
One-way ANOVA tests whether several populations share the same mean. It is the natural extension of the two-mean test when there are three or more independent groups.
The null hypothesis is \(H_0: \mu_1=\mu_2=\cdots=\mu_k\). The alternative states that at least one mean differs, but ANOVA alone does not indicate which pair of groups is different.
Calculator
Enter one group per line. Within each line, separate observations with commas, spaces or semicolons. Use a decimal point if you need decimals.
Visualization of the F test
The red zone represents the right-tail rejection region for the chosen α level. The orange line marks the observed F statistic.
One-way ANOVA formulas
ANOVA decomposes the total variability into between-group variability and within-group variability:
\(SS_T = SS_{between} + SS_{within}\)
\(F = \dfrac{MS_{between}}{MS_{within}} = \dfrac{SS_{between}/(k-1)}{SS_{within}/(N-k)}\)
\(\eta^2 = SS_{between}/SS_T\)
Under \(H_0\), the F statistic follows approximately a Snedecor's F distribution with \(k-1\) and \(N-k\) degrees of freedom.
Worked example
An agronomist evaluates the effect of three types of fertilizer on the yield (kg) of agricultural plots. 5 plots are randomly assigned to each fertilizer, yielding the following data: Fertilizer A: 32, 34, 31, 33, 35 (mean \(\bar{x}_1 = 33\)); Fertilizer B: 28, 30, 27, 29, 31 (mean \(\bar{x}_2 = 29\)); Fertilizer C: 36, 38, 35, 37, 39 (mean \(\bar{x}_3 = 37\)).
The null hypothesis is \(H_0: \mu_1 = \mu_2 = \mu_3\) (the three fertilizers produce the same mean yield) against \(H_1\): at least two means differ. We use \(\alpha = 0.05\).
The grand mean is \(\bar{x} = (33 + 29 + 37)/3 = 33\) kg. The between-groups sum of squares (variation due to fertilizer) is:
\( SS_{\text{between}} = n \sum_{j=1}^{k}(\bar{x}_j - \bar{x})^2 = 5\left[(33-33)^2 + (29-33)^2 + (37-33)^2\right] = 5(0 + 16 + 16) = 160 \)
The within-group variance of each group is \(s^2 = 2.5\). The within-groups sum of squares is:
\( SS_{\text{within}} = \sum_{j=1}^{k}(n_j - 1)\,s_j^2 = 3 \times 4 \times 2.5 = 30 \)
The degrees of freedom are \(df_{\text{between}} = k - 1 = 2\) and \(df_{\text{within}} = N - k = 15 - 3 = 12\). The mean squares are \(MS_{\text{between}} = 160/2 = 80\) and \(MS_{\text{within}} = 30/12 = 2.5\). The F statistic is:
\( F = \frac{MS_{\text{between}}}{MS_{\text{within}}} = \frac{80}{2.5} = 32 \)
The critical value for \(\alpha = 0.05\) with \((2,\, 12)\) degrees of freedom is \(F_{0.05;\,2,\,12} \approx 3.89\), and the p-value corresponding to \(F = 32\) is \(p < 0.001\). Since \(F = 32 \gg 3.89\), \(H_0\) is rejected.
Conclusion: there are highly significant statistical differences between the mean yields produced by the three fertilizers (\(p < 0.001\)). The effect size is large (\(\eta^2 = 160/190 \approx 0.84\)). To determine which pairs of fertilizers differ significantly, a post hoc test (Tukey HSD or Bonferroni) is recommended.
Important assumptions
- Independence: observations must be independent within and between groups.
- Approximate normality: the residuals of each group should be reasonably normal, especially with small samples.
- Homogeneity of variances: population variances should be similar. If this does not hold, consider alternatives such as Welch's ANOVA.
After a significant ANOVA
A significant ANOVA indicates that some difference exists, but not which one. To identify specific pairs, post hoc comparisons such as Tukey HSD are typically applied, adjusting for multiple comparisons.
How to interpret the result
Rejecting \(H_0\) (p-value < α) indicates that at least one group mean is different from the others, but ANOVA does not reveal which pairs differ nor in which direction. For that, post hoc comparisons are needed (Tukey HSD, Bonferroni, Scheffé, etc.), which control the type I error accumulated by multiple comparisons. Statistical significance does not equate to practical relevance: with large samples, small differences between means can produce a significant F. Report the effect size \(\eta^2 = SS_\text{between}/SS_\text{total}\) to quantify what proportion of the total variability the factor explains.
Failing to reject \(H_0\) (p-value ≥ α) does not prove that all means are equal; it only indicates that the data are compatible with equality at the chosen level. Insufficient power — caused by few subjects per group, high within-group variability, or small true differences — can prevent real effects from being detected. Examine the confidence intervals per group and the sample size to assess whether the study had adequate power.
The F statistic is the ratio between the variance explained by the factor (between-groups mean square, \(MS_\text{between}\)) and the unexplained residual variance (within-groups mean square, \(MS_\text{within}\)). An \(F\) close to 1 indicates that the variability among means is similar to the random variability within groups. In the chart, the green zone is the non-rejection region, the red zone is the critical right tail, and the amber line marks the observed F. ANOVA assumes independence, approximate normality of residuals, and homogeneity of variances (homoscedasticity); if the latter does not hold, consider Welch's ANOVA.
Frequently asked questions
- Can I use ANOVA with only two groups? Mathematically yes, but it is usually more straightforward to use the test for two means.
- What does η² mean? It is an effect size measure: the proportion of total variability explained by group membership.
- What is the minimum detectable effect (MDE) in ANOVA? It is the smallest effect size (for example in terms of Cohen's \(f\) or \(\eta^2\)) that the design can detect with a fixed power and \(\alpha\). Effects smaller than the MDE usually require a larger sample to become detectable.
- Does ANOVA prove that all means are different? No. It only tests whether there is evidence that at least one mean differs from the others.
Reference: Analysis of variance (ANOVA) — Wikipedia