Stats 0.4.0 tests - CyrilB1531/lodestar GitHub Wiki

Lodestar.Stats 0.4.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

Lodestar.Stats

Ten families of classical hypothesis test, at scipy.stats 1.18.0 parity. Arrays in, a statistic and a p-value out; nothing is fitted, so every entry point is static.

test what it asks entry point
Student / Welch t do two samples have the same mean? TTest
Mann-Whitney U the same question, assuming no shape MannWhitney
Wilcoxon signed-rank the same, on paired measurements Wilcoxon
χ² do counts match an expected distribution, or are two factors independent? ChiSquare
Fisher exact the same for a 2×2 table, at any sample size FisherExact
Kolmogorov-Smirnov do two samples share a distribution? KolmogorovSmirnov
one-way ANOVA do several groups share one mean? OneWayAnova
Kruskal-Wallis the same, assuming no shape KruskalWallis
Shapiro-Wilk could this sample be normal? ShapiroWilk
Bonferroni / BH / BY how many of these results are chance? MultipleComparisons

Every family but three returns the same two numbers, TestResult; a t-test also carries its degrees of freedom (TTestResult), a contingency table also carries the table independence would have produced (Chi2ContingencyResult), and Kolmogorov-Smirnov also carries where and in which direction the two samples parted furthest (KsResult).

result carries returned by
TestResult a statistic, a p-value eight of the ten families
TTestResult + degrees of freedom, a confidence interval TTest
Chi2ContingencyResult + degrees of freedom, the expected table ChiSquare.Contingency
KsResult + where the gap was reached, and its sign KolmogorovSmirnov

Five small enums choose what a test asks, and how it answers when the exact and the approximate route disagree.

option chooses
Alternative which tail the p-value covers
Variance whether an independent-samples t-test pools the two variances
Continuity whether a discrete statistic's normal approximation gets the half-unit correction
ExactMethod the exact null distribution, its normal approximation, or a choice between them
ZeroMethod what Wilcoxon does with a pair whose difference is exactly zero

The hypothesis-testing guide says which test answers which question, and the Python equivalence table maps each scipy call to its counterpart here.