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§
- Anova
Result - Result of ANOVA.
- ChiSquared
Result - Result of a chi-squared test.
- Kruskal
Wallis Result - Kruskal-Wallis H test result.
- LmResult
- Result of linear regression.
- Logistic
Result - Logistic regression result.
- Mann
Whitney Result - Mann-Whitney U test result.
- Normality
Result - Result of a normality test.
- TTest
Result - Result of a t-test.
- Tukey
HsdPair - Tukey HSD pairwise comparison result.
- Wilcoxon
Result - 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().