Companion to Chapter 17 (One-Way ANOVA). This guide walks through three fully worked examples, then gives you five practice problems to run yourself.
You may use AI assistants (ChatGPT, Claude, etc.) to help debug your R code — that’s a realistic professional skill. You may not use AI to generate your interpretations. Every write-up sentence must reflect your own reading of the output. If you use AI for any part of this assignment, note where at the end.
Analysis of Variance (ANOVA) compares the means of multiple groups to determine whether observed differences are statistically significant. It does this by analyzing the ratio of the variance between groups to the variance within groups, producing an F-statistic and a p-value.
ANOVA is used when you have a categorical independent variable (IV) — the groups or conditions being compared (e.g., task difficulty) — and a continuous dependent variable (DV) — the outcome being measured (e.g., reaction time).
When an ANOVA is significant, it tells you at least one group differs from another — not which ones. To find out, run Tukey’s Honestly Significant Difference (HSD) test, which compares every pair of groups while automatically correcting for the inflated Type I error risk from running multiple comparisons. As in Ch 17: with Tukey HSD, you don’t need to apply an additional correction yourself — the test does it for you.
A researcher wants to compare exam scores across three teaching methods.
scores <- c(78, 82, 85, 88, 84, 90, 85, 87, 89, 88, 84, 83, 82, 81, 80)
method <- factor(rep(c("A", "B", "C"), each = 5))
data <- data.frame(scores, method)
anova_result <- aov(scores ~ method, data = data)
summary(anova_result)
TukeyHSD(anova_result)
tapply(data$scores, data$method, mean)
library(effectsize)
eta_squared(anova_result)Reading the output:
APA write-up: A one-way ANOVA was conducted to examine the effect of teaching method on exam scores. Results indicated a statistically significant effect, F(2, 12) = 6.87, p = .010, η² = .53 (large effect). Tukey HSD comparisons revealed that Method B (M = 87.8) scored significantly higher than both Method C (M = 82.0, p = .010) and Method A (M = 83.4, p = .048). Methods A and C did not differ significantly (p = .676).
reaction_times <- c(220, 215, 230, 240, 225, 235, 250, 245, 260, 255, 212, 210, 218, 225, 235)
difficulty <- factor(rep(c("Moderate", "Difficult", "Easy"), each = 5))
data <- data.frame(reaction_times, difficulty)
anova_result <- aov(reaction_times ~ difficulty, data = data)
summary(anova_result)
TukeyHSD(anova_result)
tapply(data$reaction_times, data$difficulty, mean)
library(effectsize)
eta_squared(anova_result)Tukey HSD: Easy−Difficult, diff = −29.00, 95% CI [−45.58, −12.42], p = .001; Moderate−Difficult, diff = −23.00, 95% CI [−39.58, −6.42], p = .008; Moderate−Easy, diff = 6.00, 95% CI [−10.58, 22.58], p = .611 (ns).
APA write-up: Results showed a statistically significant effect of task difficulty on reaction times, F(2, 12) = 12.14, p = .001, η² = .67 (large effect). Tukey HSD comparisons revealed the Difficult condition (M = 249) had significantly longer reaction times than both Moderate (M = 226, p = .008) and Easy (M = 220, p = .001). Moderate and Easy did not differ significantly (p = .611).
satisfaction_scores <- c(75, 80, 78, 85, 83, 90, 88, 92, 91, 89, 77, 79, 74, 72, 76)
store_location <- factor(rep(c("Location 1", "Location 2", "Location 3"), each = 5))
data <- data.frame(satisfaction_scores, store_location)
anova_result <- aov(satisfaction_scores ~ store_location, data = data)
summary(anova_result)
TukeyHSD(anova_result)
tapply(data$satisfaction_scores, data$store_location, mean)
library(effectsize)
eta_squared(anova_result)Tukey HSD: Location 2−Location 1, diff = 9.80, 95% CI [4.88, 14.72], p < .001; Location 3−Location 1, diff = −4.60, 95% CI [−9.52, 0.32], p = .068 (ns); Location 3−Location 2, diff = −14.40, 95% CI [−19.32, −9.48], p < .001.
APA write-up: Results indicated a statistically significant effect of store location on satisfaction scores, F(2, 12) = 31.82, p < .001, η² = .84 (large effect). Location 2 (M = 90.0) had significantly higher satisfaction than both Location 1 (M = 80.2, p < .001) and Location 3 (M = 75.6, p < .001). Location 1 and Location 3 did not differ significantly (p = .068).
For each scenario: run the ANOVA, TukeyHSD(), and group
means as shown above. Also report the effect size —
library(effectsize); eta_squared(anova_result). Effect
sizes are reported regardless of whether the result is statistically
significant.
A biologist applies three fertilizer types (Type A, Type B, Type C) to separate groups of plants and measures height (cm) after four weeks.
plant_height <- c(18, 20, 22, 19, 21, 24, 23, 26, 25, 27, 15, 17, 14, 16, 18)
fertilizer_type <- factor(rep(c("Type A", "Type B", "Type C"), each = 5))
data <- data.frame(plant_height, fertilizer_type)Three groups of students prepare for an exam using self-study, group study, or tutoring.
exam_scores <- c(78, 82, 75, 80, 77, 85, 88, 90, 87, 86, 92, 89, 94, 91, 90)
study_strategy <- factor(rep(c("Self-Study", "Group Study", "Tutoring"), each = 5))
data <- data.frame(exam_scores, study_strategy)Participants respond to stimuli in red, blue, or green; reaction time (ms) is recorded.
reaction_times <- c(250, 245, 240, 255, 260, 230, 225, 228, 232, 234, 200, 195, 205, 198, 202)
stimulus_color <- factor(rep(c("Red", "Blue", "Green"), each = 5))
data <- data.frame(reaction_times, stimulus_color)Employees on day, evening, and night shifts rate job satisfaction (1–100).
job_satisfaction <- c(80, 85, 83, 88, 86, 72, 75, 78, 70, 73, 60, 62, 65, 63, 61)
work_shift <- factor(rep(c("Day Shift", "Evening Shift", "Night Shift"), each = 5))
data <- data.frame(job_satisfaction, work_shift)A retail company measures customer wait times (minutes) at three branches.
wait_times <- c(12, 14, 11, 13, 10, 8, 9, 7, 6, 8, 15, 16, 14, 17, 18)
branch <- factor(rep(c("Branch A", "Branch B", "Branch C"), each = 5))
data <- data.frame(wait_times, branch)