ANOVA compares the means of three or more groups by asking whether the variation between groups is larger than the variation within groups. A post-hoc test then identifies which groups differ, with a correction for the number of comparisons.
Why not just run several t-tests?
Every additional test increases the chance of a false positive. If you compare five groups with all pairwise t-tests, you perform ten tests. At a nominal 5 percent level, the chance of at least one false positive is much higher than 5 percent.
ANOVA controls the overall error rate for the question "is there any difference among these groups?" It does not tell you which groups differ. That is the job of the post-hoc comparison.
One-way ANOVA
A one-way ANOVA has one grouping factor, such as treatment with four levels. It partitions the total variation into variation between group means and variation within groups.
The test statistic is a ratio of these two variance estimates. A large ratio suggests that the group means differ by more than the within-group variability would predict. The p-value comes from the F distribution.
The assumptions are independent observations, approximately normal residuals and similar variances across groups. As with the t-test, independence is the assumption most often violated and the most damaging.
Checking the assumptions
Plot the data by group. Look at the spread and the shape. A boxplot or a dot plot with individual points is more informative than a bar chart with error bars.
Residual plots from the model show whether the variance changes with the fitted value. A funnel shape suggests heteroscedasticity. A curved pattern may suggest that the model is missing a factor or that the scale is wrong.
Formal tests for normality and equal variance exist, but they have the same small-sample and large-sample limitations as the tests discussed elsewhere. Use them as aids, not as automatic switches.
Post-hoc comparisons
After a significant ANOVA, a post-hoc test compares group means while controlling the family-wise error rate. Common approaches include Tukey's test for all pairwise comparisons, Dunnett's test for comparisons against a control, and Bonferroni or Holm adjustments for a planned set of contrasts.
The choice should follow the question. If every group is compared with every other, Tukey is a natural fit. If each treatment is compared with a single control, Dunnett is more powerful because it does not test unnecessary pairs. If the comparisons were planned in advance, a correction for the planned family is appropriate.
Do not run every possible post-hoc test and report the one that gives the most significant result. The test should be chosen before the data are analysed.
Two-way ANOVA
A two-way ANOVA has two factors and can test their main effects and their interaction. An interaction means that the effect of one factor depends on the level of the other.
A significant interaction changes the interpretation. If the effect of a drug differs between genotypes, the main effect of the drug is an average across genotypes and may not describe either one. Plot the cell means to understand the pattern.
Two-way ANOVA assumes that the observations are independent and that the residuals are approximately normal with similar variance. It also assumes that the design is balanced, or that the analysis accounts for unequal group sizes.
Repeated measures
When the same subject is measured several times, the observations are not independent. A repeated-measures ANOVA or a mixed model accounts for the correlation within subjects.
A common mistake is to treat repeated measurements as independent groups. This inflates the degrees of freedom and can produce p-values that are too small. If the sphericity assumption is doubtful, a correction or a mixed model is preferable.
Nonparametric alternatives
The Kruskal–Wallis test is the rank-based alternative to one-way ANOVA. It tests whether at least one group tends to differ in location. A significant result is followed by pairwise rank-based comparisons with a correction.
As with the Mann–Whitney test, the Kruskal–Wallis test is not simply a test of medians unless the distributions have similar shapes. Report the distributions and the effect, not only the p-value.
Effect size and reporting
A significant ANOVA says that the group means are not all equal. It does not say how large the differences are. Report the group means, the variability, the sample sizes and an effect size such as eta squared or omega squared.
For post-hoc comparisons, report the difference, the confidence interval and the adjusted p-value. State which correction was used. A table of means with letters indicating significant groups is common in biology, but the letters should be defined and the underlying comparisons should be clear.
A practical workflow
- Plot the data by group.
- Check independence and the design.
- Choose one-way, two-way or repeated-measures ANOVA.
- Check residuals and variance.
- Run the omnibus test.
- Run the planned post-hoc comparisons with a correction.
- Report effect sizes and confidence intervals.
- Interpret in biological terms, not only statistical ones.
Key points
- ANOVA tests whether any group mean differs, not which ones.
- Post-hoc tests must be planned and corrected.
- Independence is the assumption to check first.
- A significant interaction changes the interpretation.
- Report effect sizes, not only p-values.
Common mistakes
- Running many t-tests instead of an ANOVA.
- Choosing the post-hoc test after seeing the results.
- Ignoring a significant interaction.
- Treating repeated measures as independent.
- Reporting only p-values and no group means.
When to ask for help
If the design is unbalanced, if there are repeated measures or missing values, or if the interaction is hard to interpret, ask for a review. You can order an analysis or read the t-test guide. The Biostatistics & Experimental Design course covers ANOVA and post-hoc planning, and the free sample size calculator helps with the design.
Sources and further reading
Written by the Solagene team for research and education. Found an error? Tell us and we will correct it.