This Three-Way ANOVA Calculator helps you analyze the effects of three independent variables (factors) on a dependent variable. It calculates main effects and interaction effects between factors, helping you understand how multiple categorical variables influence your outcome measure. For example, you can analyze how teaching method, student gender, and grade level affect test scores, or how temperature, pressure, and catalyst type affect chemical reaction yields. Click here to populate the sample data for a quick example.
Calculator
1. Load Your Data
2. Select Columns & Options
Learn More
Three-Way ANOVA
Definition
- Main effects of each factor
- Interaction effects between factors
- The three-way interaction between all three factors
Model
Where:
- = dependent variable value for the th observation in the group
- = overall mean
- = main effects of factors
- = two-way interaction effects
- = three-way interaction
- = error (residual) term
Test statistic for each factor:
Key Assumptions
Practical Example
Step 1: State the Data
Investigating the effects of teaching method, gender, and grade level on test scores:
- Dependent Variable: Test Score
- Factor A: Teaching Method (Lecture, GroupWork, Mixed)
- Factor B: Gender (Male, Female)
- Factor C: Grade Level (9th, 10th)
- Sample Size: 60 students
Teaching Method | Gender | Grade | Test Scores |
---|---|---|---|
Lecture | Male | 9th | 98 |
Lecture | Male | 9th | 84 |
Lecture | Male | 10th | 98 |
GroupWork | Male | 9th | 72 |
GroupWork | Male | 10th | 72 |
... |
For the complete dataset, please refer to the code examples below.
Step 2: State Hypotheses
Main Effects:
- : No effect of teaching method
- : No effect of gender
- : No effect of grade level
Interactions:
- : No method × gender interaction
- : No method × grade interaction
- : No gender × grade interaction
- : No three-way interaction
Step 3: ANOVA Results
Source | SS | df | MS | F | p-value |
---|---|---|---|---|---|
Method | 68 | 2 | 34.22 | 0.403 | 0.671 |
Gender | 180 | 1 | 180.27 | 2.123 | 0.152 |
Grade | 38 | 1 | 38.40 | 0.452 | 0.504 |
Method:Gender | 66 | 2 | 32.92 | 0.388 | 0.681 |
Method:Grade | 218 | 2 | 108.95 | 1.283 | 0.286 |
Gender:Grade | 4 | 1 | 4.27 | 0.050 | 0.824 |
Method:Gender:Grade | 137 | 2 | 68.52 | 0.807 | 0.452 |
Residuals | 4076 | 48 | 84.91 |
Step 4: Conclusions
- No significant main effect of Method (F(2,48) = 1.283, p = .286)
- No significant main effect of Gender (F(1,48) = 0.452, p = .504)
- No significant main effect of Grade (F(1,48) = 0.388, p = .681)
- No significant two-way interactions: Method:Gender (F(2,48) = 0.388, p = .681), Method:Grade (F(2,48) = 1.283, p = .286), Gender:Grade (F(1,48) = 0.050, p = .824)
- No significant three-way interaction between Method:Gender:Grade (F(2,48) = 0.807, p = .452)
Code Examples
library(tidyverse)
set.seed(42)
# Data preparation
data <- tibble(
Method = rep(c("Lecture", "GroupWork", "Mixed"), each = 20),
Gender = rep(rep(c("Male", "Female"), each = 10), 3),
Grade = rep(c("9th", "10th"), each = 5, times = 6),
Score = round(runif(60, min = 70, max = 100))
)
# Run 3-way ANOVA
model <- aov(Score ~ Method * Gender * Grade, data = data)
summary(model)
import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.stats.anova import anova_lm
np.random.seed(42)
# Create example data
data = pd.DataFrame({
'Method': np.repeat(['Lecture', 'GroupWork', 'Mixed'], 20),
'Gender': np.tile(np.repeat(['Male', 'Female'], 10), 3),
'Grade': np.tile(np.repeat(['9th', '10th'], 5), 6),
'Score': np.random.randint(70, 100, 60)
})
# Fit the model
model = sm.OLS.from_formula('Score ~ Method * Gender * Grade', data=data).fit()
# Get ANOVA table
anova_table = anova_lm(model, typ=3)
print(anova_table)
Post-Hoc Analysis
For significant effects:
- Tukey HSD: Compare all pairs of levels
- Simple Effects Analysis: Examine one factor at levels of others
Verification
Related Calculators
Help us improve
Found an error or have a suggestion? Let us know!