One-Way ANOVA

A beginner-friendly walkthrough of one-way ANOVA with visual insight into between- and within-group variance.

ANOVAvarianceBeginner

Understanding One-Way ANOVA Step by Step

When comparing more than two groups, how do we decide whether their means are statistically different? This is where one-way ANOVA (Analysis of Variance) comes in.

In this article, you’ll learn not only the formulas behind ANOVA, but also why each step matters — and you’ll visually explore the key concepts using a guided interactive tool.


🔷 1. Problem Setup

Imagine we have test scores from three different classes:

ClassScores
A56, 60, 58, 62, 59
B70, 72, 75, 68, 74
C45, 50, 48, 52, 47

Our goal is to determine whether these three classes differ significantly in their average scores.


🔷 2. Hypothesis and Logic

We begin with two competing hypotheses:

  • Null hypothesis (H_0): All group means are equal

    H0:μ1=μ2=μ3H_0: \mu_1 = \mu_2 = \mu_3
  • Alternative hypothesis (H_1): At least one mean is different

    H1: ij, μiμjH_1: \exists\ i \neq j,\ \mu_i \neq \mu_j

The idea behind ANOVA is to compare how much the group means differ (between-group variability) with how much the data vary within each group (within-group variability).


🔶 3. Step 1: Calculate Group and Overall Means

Before testing anything, we need reference points:

  • Group means:

    xˉi=1nij=1nixij\bar{x}_i = \frac{1}{n_i} \sum_{j=1}^{n_i} x_{ij}
  • Overall mean (grand mean):

    xˉ=1Ni=1kj=1nixijwhere N=i=1kni\bar{x} = \frac{1}{N} \sum_{i=1}^{k} \sum_{j=1}^{n_i} x_{ij} \quad \text{where } N = \sum_{i=1}^k n_i

This gives us the average for each class and the average across all students. These values will serve as anchors for calculating variability.


🔶 4. Step 2: Decompose Variability

To test whether the means differ significantly, we analyze how total variability breaks down.

There are three types of sum of squares:

✅ Total Sum of Squares (SST)

The total variability of all data from the grand mean:

SST=i=1kj=1ni(xijxˉ)2\text{SST} = \sum_{i=1}^{k} \sum_{j=1}^{n_i} (x_{ij} - \bar{x})^2

✅ Between-Group Sum of Squares (SSB)

The variability between group means:

SSB=i=1kni(xˉixˉ)2\text{SSB} = \sum_{i=1}^{k} n_i (\bar{x}_i - \bar{x})^2

✅ Within-Group Sum of Squares (SSW)

The variability within each group:

SSW=i=1kj=1ni(xijxˉi)2\text{SSW} = \sum_{i=1}^{k} \sum_{j=1}^{n_i} (x_{ij} - \bar{x}_i)^2

These satisfy the identity:

SST=SSB+SSW\text{SST} = \text{SSB} + \text{SSW}

Understanding this decomposition is the heart of ANOVA.


🔶 5. Step 3: Normalize Variance

We convert sums of squares into mean squares by dividing by their degrees of freedom:

  • Between-group variance (MSB):

    MSB=SSBk1\text{MSB} = \frac{\text{SSB}}{k - 1}
  • Within-group variance (MSW):

    MSW=SSWNk\text{MSW} = \frac{\text{SSW}}{N - k}

This step allows us to make fair comparisons regardless of sample size.


🔶 6. Step 4: Compute the F Statistic

Finally, we compute the F ratio, which compares between-group to within-group variance:

F=MSBMSWF(k1, Nk)F = \frac{\text{MSB}}{\text{MSW}} \sim F(k - 1,\ N - k)

If this ratio is large enough, it suggests that the group means are different beyond what we’d expect from random variation.


Interactive: Explore SSB, SSW, and the ANOVA Process

Interactive One-Way ANOVA Explorer

📊 Edit Your Data

Group A

Mean: 59.00

Group B

Mean: 71.80

Group C

Mean: 48.40
Grand Mean: 59.73

Step 1: Calculate Group and Overall Means

First, we calculate the mean for each group and the overall grand mean.

📈 Means Calculation

Group Means:
  • Group A: 59.00
  • Group B: 71.80
  • Group C: 48.40
Grand Mean:

59.73

Average of all 15 data points

Use the interactive below to explore:

  1. Compare group averages vs. overall mean. You can also edit data.
  2. How SSB increases when group means diverge
  3. How SSW increases with more internal spread
  4. How F is calculated with the data

Summary

One-way ANOVA tests whether group means differ significantly by analyzing and comparing two sources of variation:

  • Between-group variance (SSB): Differences among group means
  • Within-group variance (SSW): Variability within each group

By calculating the F statistic as the ratio of these two variances, we can determine whether observed differences are likely due to random variation or reflect real group effects.

← Back to Encyclopedia