pairwise_group_comparisons
Run pairwise statistical comparisons across multiple groups with automatic multiple-comparison correction. Choose t-test or Mann-Whitney, get p-values, effect sizes, and correction details in one call.
Instructions
Run every pairwise comparison across 2+ groups and correct for multiple comparisons in one call, instead of orchestrating k*(k-1)/2 separate two_sample_t_test/mann_whitney_u calls plus a separate correction call by hand -- and forgetting the correction is one of the most common real mistakes this package exists to prevent. The natural follow-up after a significant one_way_anova/kruskal_wallis result: pass the same groups here to find which group(s) differ, not just whether any do. Returns every pair's statistic, raw p-value, whether it's still significant after correction, and an effect size, plus the correction method's citation and warnings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| test | No | "t_test" (two_sample_t_test per pair, reports cohens_d) or "mann_whitney" (mann_whitney_u per pair, reports rank_biserial_correlation) -- match whichever you used for the overall group comparison (one_way_anova vs. kruskal_wallis) | t_test |
| alpha | No | significance level for the test (and any confidence interval); default 0.05 | |
| groups | Yes | one list of observations per group; at least 2 groups | |
| labels | No | optional name per group, same length and order as groups; carried through to each comparison for readability | |
| equal_var | No | only used when test="t_test": assume equal population variances (pooled) instead of Welch's test, same meaning as two_sample_t_test's equal_var | |
| correction | No | "bh" (Benjamini-Hochberg, less conservative, default), "bonferroni" (more conservative), or "none" (raw p-values, e.g. if correcting elsewhere) | bh |