[Durgical](https://durgical.com/en/) › [DurgiPedia](https://durgical.com/en/durgipedia/) › [Epidemiology](https://durgical.com/en/epidemiology/) › [Biostatistics](https://durgical.com/en/epidemiology/areas/stats/) › Analysis of variance (ANOVA)

# Analysis of variance (ANOVA)

- Statistical test

It compares the means of three or more groups at once, in a single test, without inflating the risk of a false positive.

Updated Nov 5, 2026

## Key points

- H0: all means are equal. H1: at least one differs.
- F = mean square between groups / mean square within groups.
- Degrees of freedom: between groups = k − 1; within = N − k (k groups, N people).
- Assumptions: independent observations, normality in each group and similar variances.
- Post hoc: Tukey, Bonferroni or Scheffé show which pairs differ.
- Non-parametric alternative: Kruskal-Wallis. With two groups, ANOVA equals the t test (F = t²).

## What it is

One-way analysis of variance (ANOVA) compares the means of three or more independent groups. It splits the total variation into a between-group part and a within-group part; if the variation between groups is much larger than expected from the variation within them, the F statistic is large. A significant ANOVA says that at least one mean differs, but not which: post-hoc tests with a multiple-comparison adjustment answer that.

## When to use it

- Three or more means of independent groups, with a numerical outcome.
- Two-way ANOVA: two factors at once (for example treatment and sex) and their interaction.
- Repeated-measures ANOVA: the same people measured at several time points.

## Worked example

- Data: sleep quality score (0 to 15) with 3 routines, 4 people each. A: 4, 5, 6, 5; B: 6, 7, 8, 7; C: 7, 9, 10, 10.
- Means: A = 5, B = 7, C = 9; grand mean = 7.
- Between-group sum of squares = 4 × [(5 − 7)² + 0² + (9 − 7)²] = 4 × 8 = 32; df = 3 − 1 = 2; mean square = 16.
- Within groups: A = 1 + 0 + 1 + 0 = 2; B = 2; C = 4 + 0 + 1 + 1 = 6; total = 10; df = 12 − 3 = 9.
- Mean square within = 10 / 9 = 1.11.
- F = 16 / 1.11 = 14.4. The critical F(2, 9) at α = 0.05 is 4.26; p ≈ 0.002.
- H0 is rejected. A post-hoc test (for example Tukey) would show which pairs of routines differ.
- Reading: at least one routine gives different sleep; ANOVA alone does not say which.

## Markers

- F
- df
- post hoc
- Tukey

## Assumptions and pitfalls

- Stopping at a significant ANOVA without saying which groups differ.
- Running post-hoc tests without a multiple-comparison adjustment.
- Using one-way ANOVA for repeated measurements in the same people.

## Memory aid

‘ANOVA alerts, post hoc points’: F says there is a difference; post-hoc tests say where.

## Test yourself

Think of the answer, then tap the question to see it.

## What null hypothesis does a one-way ANOVA test?

That the means of all groups are equal.

## What follows a significant ANOVA?

Post-hoc tests with a multiple-comparison adjustment, such as Tukey or Bonferroni, to find which pairs of groups differ.

## Which non-parametric test replaces one-way ANOVA?

The Kruskal-Wallis test.

## With 4 groups and 40 people in total, what are the ANOVA degrees of freedom?

Between groups: 4 − 1 = 3. Within groups: 40 − 4 = 36.

[Add to my cards (4)](https://durgical.app/estudiar/?add=/en/epidemiology/analysis-of-variance/)

## Connections

## Related 4

- [Student's t test](https://durgical.com/en/epidemiology/student-s-t-test/)
- [Multiple comparisons](https://durgical.com/en/epidemiology/multiple-comparisons/)
- [Non-parametric tests](https://durgical.com/en/epidemiology/non-parametric-tests/)
- [Choosing a statistical test](https://durgical.com/en/epidemiology/choosing-a-statistical-test/)

[← All of epidemiology](https://durgical.com/en/epidemiology/)

Educational content on epidemiological and statistical methods; the examples use made-up numbers to teach the calculation. Not a clinical or legal guide: current Colombian rules are in the official sources.

Sources: [One-Factor ANOVA](https://www.itl.nist.gov/div898/handbook/eda/section3/eda354.htm) (NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology, 2012); [One-way ANOVA overview](https://www.itl.nist.gov/div898/handbook/prc/section4/prc431.htm) (NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology, 2012); [How can we make multiple comparisons?](https://www.itl.nist.gov/div898/handbook/prc/section4/prc47.htm) (NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology, 2012).

## **Spotted a mistake?** We are always improving for the community. Tell us what is wrong and our team will review it. Report a mistake

Representative model, for educational purposes only.

---
Source: https://durgical.com/en/epidemiology/analysis-of-variance/
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Cite as: DurgiPedia (durgical.com), https://durgical.com/en/epidemiology/analysis-of-variance/
