Course contentsShow
← Data Science
Lesson 441 of 2,14512. ANOVA and Multiple ComparisonsFree lesson

Sum of Squares: Total, Between, and Within

Decomposing total variance into between-group and within-group components for ANOVA calculations.

Sum of Squares: Total, Between, and Within

What You'll Learn

You'll learn how ANOVA breaks down total variance into two distinct components—variance between groups and variance within groups—to determine if group means truly differ.

The Core Idea

Imagine you're measuring the heights of students from three different schools. Not all students have the same height—there's total variation in the data. ANOVA asks: "Is this variation mostly because students from different schools tend to be different heights (between-school differences), or just because individuals naturally vary regardless of school (within-school variation)?"

ANOVA decomposes the total sum of squares (SST) into two parts:

SST = SSB + SSW

Where:

  • SST (Total Sum of Squares): Measures how much each observation differs from the overall mean across all groups
  • SSB (Between-group Sum of Squares): Measures how much each group mean differs from the overall mean (scaled by group size)
  • SSW (Within-group Sum of Squares): Measures how much individuals vary within their own groups

Think of it like a budget: your total spending (SST) equals money spent on different categories (SSB) plus random day-to-day variations (SSW).

Why This Matters for the F-Statistic

The F-statistic you learned about compares the between-group variance to the within-group variance. By calculating these sums of squares first, we quantify how much variation is due to group membership versus random chance. A large SSB relative to SSW suggests real group differences exist.

Key Takeaway: ANOVA decomposes total variance (SST) into between-group variance (SSB) and within-group variance (SSW), letting us test whether group differences explain meaningful variation in the data.