One-Way ANOVA: Comparing Three or More Groups
Basira Team · · 1 min read
- #anova
- #hypothesis-testing
- #analysis-of-variance
To compare the means of two groups we use a t-test. But what if we have three, four, or more groups? This is where one-way ANOVA (Analysis of Variance) comes in.
Why not multiple t-tests?
Running several pairwise t-tests inflates the Type I error rate. With per test, the chance of finding at least one false significant result across three comparisons climbs to about 14%.
The F statistic
ANOVA compares between-group variance to within-group variance:
When the differences between groups are large relative to the random variation within groups, grows and the value shrinks.
Assumptions
A quick look with Python
from scipy import stats
group_a = [82, 85, 88, 90, 86]
group_b = [78, 81, 84, 80, 83]
group_c = [91, 94, 89, 95, 92]
f_stat, p_value = stats.f_oneway(group_a, group_b, group_c)
print(f"F = {f_stat:.2f}, p = {p_value:.4f}")
When you find a significant result (), move on to post-hoc tests (such as Tukey HSD) to see which groups differ.
Run it in Basira
Try the steps above on your own data in one click — assumption checks, post-hoc tests, and effect size are computed automatically.
Run in Basira
Upload your data, pick the grouping variable, and let Basira produce the F statistic, post-hoc tests, and effect size for you.