Expand description
More tests comparing samples, following scipy.stats: equal variances (Levene, Bartlett,
Fligner-Killeen), rank tests (Kruskal-Wallis, Friedman, Wilcoxon signed-rank), exact tests
(Fisher’s exact test for 2 × 2 tables, the binomial test), permutation tests, and the
adjustment of p-values for multiple comparisons (Benjamini-Hochberg, Benjamini-Yekutieli,
Holm, Bonferroni).
See the book entry More hypothesis tests.
Structs§
- Monte
Carlo Result - The result of
monte_carlo_test. - Permutation
Result - The result of
permutation_test.
Enums§
- Adjustment
- How
adjust_p_valuescontrols the error rate across many tests. - Brunner
Munzel Distribution - The reference distribution of the Brunner-Munzel statistic.
Functions§
- adjust_
p_ values - Adjusted p-values: reject the hypotheses whose adjusted p-value is at most the target rate.
- bartlett
- Bartlett’s test of equal variances for normal samples (SciPy’s
bartlett), χ² withk − 1degrees of freedom. - binomtest
- The exact binomial test of
ksuccesses inntrials against success probabilityp(SciPy’sbinomtest); the two-sided p-value sums the probabilities of all outcomes no more likely thank. The statistic isk / n. - brunnermunzel
- The Brunner-Munzel test of
P(X < Y) + ½ P(X = Y) = ½(SciPy’sbrunnermunzel): unlike the Mann-Whitney test it does not assume equal variances or shapes. With ranksRin the pooled sample andR⁽ˣ⁾within each sample, the placement variances areS_x² = Σ (R_i − R_i⁽ˣ⁾ − R̄ + R̄⁽ˣ⁾)² / (n_x − 1)(likewise fory), andW = n_x n_y (R̄_y − R̄_x) / ((n_x + n_y) √(n_x S_x² + n_y S_y²)). - fisher_
exact - Fisher’s exact test for a 2 × 2 table
[[a, b], [c, d]](SciPy’sfisher_exact): the statistic is the sample odds ratioad / bc, and the p-value comes from the hypergeometric distribution ofawith the margins fixed; the two-sided p-value sums the probabilities of all tables no more likely than the observed one. - fligner
- The Fligner-Killeen test of equal variances (SciPy’s
fligner, median centring): normal scores of the ranks of the absolute deviations, compared across groups; robust to non-normality. - friedman
- Friedman’s test for
ktreatments measured on the samenblocks (SciPy’sfriedmanchisquare):treatments[j][i]is treatmentjon blocki. Ranks within each block, with the tie correction, χ² withk − 1degrees of freedom. - kruskal
- The Kruskal-Wallis H test that
ksamples come from the same distribution (SciPy’skruskal), with the tie correction, χ² withk − 1degrees of freedom. - levene
- Levene’s test of equal variances with Brown and Forsythe’s median centring (SciPy’s
levenewithcenter='median'): one-way ANOVA on the absolute deviations from each group’s median, referred to the F distribution withk − 1andN − kdegrees of freedom. - monte_
carlo_ test - A Monte Carlo hypothesis test (SciPy’s
monte_carlo_test): the statistic of the observed samples is compared with its values onn_resamplessets of samples of the same sizes drawn from the null distribution byrvs(sample index, size, rng). The p-value counts the observed value among the resamples,(#{T* ≥ T} + 1)/(n + 1), so it is never zero, and two-sided p-values double the smaller tail. - permutation_
test - A two-sample permutation test (SciPy’s
permutation_testwithpermutation_type='independent'): the statisticf(x, y)is recomputed for every way of splitting the pooled observations into groups of the original sizes when there are at mostn_resamplesof them (exact), and otherwise forn_resamplesrandom splits, for which the p-value counts the observed split as well. - wilcoxon
- The Wilcoxon signed-rank test that the differences
d(orx − y) are symmetric about zero (SciPy’swilcoxonwith its defaults: zeros dropped, no continuity correction). Without ties or zeros the p-value is exact, from the distribution ofW⁺computed by dynamic programming over the ranks; with ties, by enumerating all sign changes whenn ≤ 13, and otherwise from the normal approximation with the tie correction. For the two-sided test the statistic ismin(W⁺, W⁻), otherwiseW⁺.