Once you understand testing, the practical question is which test to run. The answer depends on your data types and what you're comparing — here's a decision map for the everyday tests.
The decision map
| Question | Test |
|---|---|
| Is one mean different from a value? | One-sample t-test |
| Do two groups differ on a mean? | Two-sample t-test |
| Before vs after on the same subjects? | Paired t-test |
| Do 3+ groups differ on a mean? | ANOVA |
| Are two categorical variables related? | Chi-squared |
| Do two numeric variables move together? | Correlation test |
from scipy import statsstats.ttest_ind(group_a, group_b) # two independent groupsstats.f_oneway(g1, g2, g3) # ANOVA — 3+ groupsstats.chi2_contingency(table) # categorical association
Key takeaways
- 01Choose a test by data types and what you're comparing.
- 02t-tests compare means (one-sample, two-sample, paired); ANOVA compares 3+ group means.
- 03Chi-squared tests association between categorical variables.
- 04Don't run many t-tests for 3+ groups; check each test's assumptions.
