Skip to content

ANOVA (one-way)

If you compare 3+ groups with many t-tests, you increase false positives.

ANOVA tests:

  • H0: all group means are equal
  • H1: at least one mean differs
One-way ANOVA
import numpy as np
from scipy import stats
 
A = np.array([10, 12, 11, 13, 12])
B = np.array([7, 8, 9, 8, 7])
C = np.array([14, 15, 13, 16, 14])
 
f_stat, p = stats.f_oneway(A, B, C)
print("F:", f_stat)
print("p:", p)

ANOVA says “some difference exists” but not where.

Next steps:

  • Post-hoc tests (e.g., Tukey HSD)
  • Pairwise comparisons with correction
  • Independence
  • Normality within groups (approx)
  • Homogeneity of variances

If variances differ a lot, consider Welch ANOVA or non-parametric alternatives.

diagram ANOVA vs. repeated t-tests mermaid
Running many pairwise t-tests inflates false positives; ANOVA tests all groups at once.

Continue to Chi-Square Test to compare categorical variables instead of numeric means.

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading