Skip to main content
Albero Academy

ANOVA & Chi-Squared

Compare several groups, and test categorical relationships.

Relationships & Modeling9 min

Two more essential tests for relationships. ANOVA compares the means of three or more groups; chi-squared tests whether two categorical variables are related.

ANOVA

Comparing 3+ group means with many t-tests inflates false positives. ANOVA tests whether any group mean differs, in one test — by comparing variation between groups to variation within them. A significant result says "at least one differs"; follow up to find which.

scipy
from scipy import stats
stats.f_oneway(group_a, group_b, group_c) # one-way ANOVA
stats.chi2_contingency(contingency_table) # categorical association

Chi-squared

Key takeaways

  1. 01ANOVA compares 3+ group means in one test (avoiding inflated false positives from many t-tests).
  2. 02It compares between-group to within-group variation; a hit means "at least one differs".
  3. 03Chi-squared tests whether two categorical variables are related (a contingency table).
  4. 04t-test/ANOVA/chi-squared/regression cover most everyday statistical questions.

Finished this chapter?

Mark it complete to track your progress through Statistics.