With three or more groups, running t-tests between every pair inflates your false-positive rate. One-way ANOVA fixes this by asking a single question first: is there any difference among the group means at all? R's built-in PlantGrowth data is the classic example: plant yields under a control and two treatment conditions.
Look at the groups first
aggregate(weight ~ group, data = PlantGrowth, FUN = mean)Output
group weight
1 ctrl 5.032
2 trt1 4.661
3 trt2 5.526Fit the ANOVA with aov()
Same formula pattern as always: outcome ~ group. Fit with aov(), then ask for the F table with summary().
model <- aov(weight ~ group, data = PlantGrowth)
summary(model)Output
Df Sum Sq Mean Sq F value Pr(>F)
group 2 3.766 1.8832 4.846 0.0159 *
Residuals 27 3.881 0.1438
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1The row for group is your result: F(2, 27) = 4.85, p = .016. The two degrees of freedom are the group df (number of groups minus 1) and the residual df; you report both, in that order.
Which groups differ? Tukey's HSD
A significant F only says the means are not all equal. Tukey's Honest Significant Difference test compares every pair while keeping the overall error rate controlled:
model <- aov(weight ~ group, data = PlantGrowth)
TukeyHSD(model)Output
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = weight ~ group, data = PlantGrowth)
$group
diff lwr upr p adj
trt1-ctrl -0.371 -1.0622161 0.3202161 0.3908711
trt2-ctrl 0.494 -0.1972161 1.1852161 0.1979960
trt2-trt1 0.865 0.1737839 1.5562161 0.0120064Only the trt2 vs trt1 comparison survives (p adj = .012). This is a common and honest outcome: an overall effect driven by one specific contrast.
Reporting it in APA style
Plant yield differed significantly across conditions, F(2, 27) = 4.85, p = .016. Tukey's HSD showed treatment 2 outperformed treatment 1 (p = .012); no other pairwise difference was significant.
- Report F with both df: F(between, within)
- Journals expect an effect size for ANOVA too (eta squared or omega squared), computed from the sums of squares in the table above
- Check assumptions: roughly normal residuals and similar spread per group (
plot(model)gives quick diagnostic plots)
Group comparisons handled. Next: relationships between two continuous variables, correlation and regression.
