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

Introduction to Two-Way ANOVA

Understanding when to use two-way ANOVA to test effects of two categorical factors simultaneously.

Introduction to Two-Way ANOVA

You'll learn when and why to use two-way ANOVA to study the effects of two categorical factors at once.

So far, you've used one-way ANOVA to compare means across multiple groups defined by a single factor (like comparing test scores across three teaching methods). But what if you want to study two factors simultaneously—and understand how they work together?

What is Two-Way ANOVA?

Two-way ANOVA extends the logic of one-way ANOVA to examine the effects of two categorical independent variables (factors) on a continuous outcome. For example:

  • Factor A: Teaching method (online, hybrid, in-person)
  • Factor B: Time of day (morning, afternoon)
  • Outcome: Test scores

Two-way ANOVA answers three questions:

  1. Does Factor A have an effect? (main effect of teaching method)
  2. Does Factor B have an effect? (main effect of time of day)
  3. Does the combination of A and B create unique effects? (interaction effect)

Why Use Two-Way ANOVA?

Imagine running separate one-way ANOVAs for teaching method and time of day. You'd miss a critical insight: perhaps online learning works best in the afternoon, while in-person works best in the morning. This is an interaction—where the effect of one factor depends on the level of the other.

Two-way ANOVA efficiently tests both main effects and interactions in one analysis, giving you a richer understanding of your data than running multiple separate tests.

When Should You Use It?

Use two-way ANOVA when you have:

  • One continuous dependent variable
  • Two categorical independent variables (factors)
  • Interest in understanding both factors' individual effects and their interaction

Key Takeaway: Two-way ANOVA lets you simultaneously test the effects of two categorical factors and discover whether they interact, providing a more complete picture than separate one-way analyses.