Stats tests - CyrilB1531/lodestar GitHub Wiki
Hypothesis tests — Lodestar.Stats
Eighteen families of classical hypothesis test, at scipy.stats 1.18.1 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? | ChiSquared |
| 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 |
| Pearson r | are these two variables related, along a line? | Pearson |
| Spearman rho | the same, along any rising or falling curve | Spearman |
| point-biserial | how a variable differs between the two sides of a binary one | PointBiserial |
| Kendall tau | the same, counted pair by pair | KendallTau |
| Levene | do several groups share one variance? | Levene |
| Bartlett | the same, assuming each group is normal | Bartlett |
| Fligner-Killeen | the same, by ranks | Fligner |
| Friedman | do several treatments differ on the same subjects? | Friedman |
| binomial | is this proportion what it was said to be? | Binomial |
| Anderson-Darling | could this sample be normal, or do several share a distribution? | AndersonDarling |
Every family but six 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
(ChiSquaredContingencyResult), Kolmogorov-Smirnov also carries
where and in which direction the two samples parted furthest (KsResult),
a Pearson correlation and a binomial test each carry what their intervals need
(PearsonResult, BinomialResult), and
Anderson-Darling carries the table its statistic is read against
(AndersonResult). Spearman's rho over every pair of variables returns
both matrices (CorrelationMatrix).
| result | carries | returned by |
|---|---|---|
TestResult |
a statistic, a p-value | fourteen of the twenty families |
TTestResult |
+ degrees of freedom, a confidence interval | TTest |
ChiSquaredContingencyResult |
+ degrees of freedom, the expected table | ChiSquared.Contingency |
KsResult |
+ where the gap was reached, and its sign | KolmogorovSmirnov |
PearsonResult |
+ a confidence interval for the correlation | Pearson |
BinomialResult |
+ a confidence interval for the proportion | Binomial |
AndersonResult |
+ the critical values and their significance levels | AndersonDarling |
CorrelationMatrix |
a statistic and a p-value for every pair of variables | Spearman.Matrix |
Nine 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 |
KendallVariant |
which normalisation Kendall's tau carries; the p-value is the same either way |
Center |
which centre Levene's and Fligner-Killeen's tests measure each group's spread around |
AndersonKSampleVariant |
which form of the k-sample Anderson-Darling statistic is computed |
ProportionInterval |
which interval a binomial proportion is reported with |
The hypothesis-testing guide says which
test answers which question, and the
Python equivalence table maps each scipy call to its
counterpart here.