Skip to main content

Module hypothesis

Module hypothesis 

Source
Expand description

Hypothesis testing: t-test, chi-squared test, paired t-test. Statistical hypothesis tests — t-test (one-sample, two-sample, paired), chi-squared goodness-of-fit, ANOVA, F-test.

§Determinism Contract

All tests are deterministic — same input => identical results. Uses Kahan summation for all reductions.

Structs§

AnovaResult
Result of ANOVA.
ChiSquaredResult
Result of a chi-squared test.
KruskalWallisResult
Kruskal-Wallis H test result.
LmResult
Result of linear regression.
LogisticResult
Logistic regression result.
MannWhitneyResult
Mann-Whitney U test result.
NormalityResult
Result of a normality test.
TTestResult
Result of a t-test.
TukeyHsdPair
Tukey HSD pairwise comparison result.
WilcoxonResult
Wilcoxon signed-rank test result.

Functions§

anderson_darling
Anderson-Darling test for normality. Compares the empirical CDF to a normal CDF.
anova_oneway
One-way ANOVA: compare means across groups.
bartlett_test
Bartlett’s test for equality of variances.
bonferroni
Bonferroni correction: adjusted_p[i] = min(p[i] * m, 1.0).
chi_squared_test
Chi-squared goodness-of-fit test.
cohens_d
Cohen’s d: standardized difference between two group means.
cramers_v
Cramér’s V: association between two categorical variables. Input: contingency table as flat row-major array with dimensions r x c.
eta_squared
Eta-squared: proportion of variance explained by group membership. Input: array of groups (each is a slice of f64).
f_test
F-test for equality of variances.
fdr_bh
Benjamini-Hochberg FDR correction.
jarque_bera
Jarque-Bera normality test. Tests whether data has skewness and kurtosis matching a normal distribution. JB = (n/6) * (S² + (K-3)²/4)
kruskal_wallis
Kruskal-Wallis H test: non-parametric one-way ANOVA on ranks.
ks_test_normal
Kolmogorov-Smirnov one-sample test for normality. Compares empirical distribution to a standard normal.
levene_test
Levene’s test for equality of variances across groups.
lm
Ordinary least squares regression: y = Xb + e. x_matrix: flattened row-major (n x p), y: (n). Adds intercept column automatically. Uses QR decomposition for numerical stability.
logistic_regression
Logistic regression via IRLS. x_flat: row-major n x p matrix (NO intercept column — auto-added). y: binary 0/1 response.
mann_whitney
Mann-Whitney U test (Wilcoxon rank-sum test).
t_test
One-sample t-test: is the mean significantly different from mu?
t_test_paired
Paired t-test.
t_test_two_sample
Two-sample independent t-test (Welch’s — unequal variance).
tukey_hsd
Tukey HSD post-hoc test after one-way ANOVA.
wilcoxon_signed_rank
Wilcoxon signed-rank test for paired data.
wls
Weighted least squares regression. Transforms to OLS: X_w = W^{1/2} * X, y_w = W^{1/2} * y. Then applies standard QR-based least squares via lm().