Skip to content

Latest commit

 

History

History
21 lines (21 loc) · 5.02 KB

File metadata and controls

21 lines (21 loc) · 5.02 KB
Test Purpose (What it checks) Data Type Key Assumptions Python (scipy/statsmodels)
One-sample t-test Compare sample mean to a known value Numeric Normal data stats.ttest_1samp(x, μ)
Independent t-test Compare means of 2 independent groups Numeric (2 groups) Normal, equal variance stats.ttest_ind(a, b)
Paired t-test Compare same group before vs after Numeric (paired) Normal differences stats.ttest_rel(a, b)
One-way ANOVA Compare means of 3+ groups Numeric (3+ groups) Normal, equal variance stats.f_oneway(g1, g2, g3)
One-way ANOVA (OLS) Check if mean age differs across classes Numeric (age) + categorical (class) Normal residuals, equal variance, independent samples ols('age ~ class', data=df).fit() + sm.stats.anova_lm(model)
Two-way ANOVA Effect of 2 factors on mean Numeric + categorical Normal, equal variance statsmodels.formula.api.ols()
Mann–Whitney U 2 groups, non-normal Ordinal/Numeric Independent stats.mannwhitneyu(a, b)
Wilcoxon test Paired, non-normal Ordinal/Numeric Paired stats.wilcoxon(a, b)
Kruskal–Wallis 3+ groups, non-normal Ordinal/Numeric Independent stats.kruskal(g1, g2, g3)
Chi-square test Relationship between categories Categorical Expected freq > 5 stats.chi2_contingency(table)
Fisher’s Exact Small categorical samples Categorical 2×2 table stats.fisher_exact(table)
Pearson correlation Linear relation between 2 vars Numeric Normal, linear stats.pearsonr(x, y)
Spearman correlation Rank-based relation Ordinal/Numeric Monotonic stats.spearmanr(x, y)
Linear regression Predict Y from X Numeric Linearity, normal errors stats.linregress(x, y)
Logistic regression Predict binary outcome Numeric + categorical Independent sklearn.linear_model.LogisticRegression()
Shapiro-Wilk Test for normality Numeric Random sample stats.shapiro(x)
Kolmogorov–Smirnov Compare to a distribution Numeric Continuous stats.kstest(x, 'norm')
Levene’s test Test equal variance Numeric Independent stats.levene(a, b)
Tukey’s HSD Find which specific groups differ after ANOVA Numeric + categorical (3+ groups) Normal data, equal variance, independent groups statsmodels.stats.multicomp.pairwise_tukeyhsd(endog=y, groups=g)