Expand description
Hypothesis testing.
Parametric and non-parametric statistical tests: t-tests, ANOVA, chi-squared tests, and normality tests.
§Examples
use u_analytics::testing::{one_sample_t_test, TestResult};
let data = [5.1, 4.9, 5.2, 5.0, 4.8, 5.3, 5.1, 4.9];
let result = one_sample_t_test(&data, 5.0).unwrap();
assert!(result.p_value > 0.05); // cannot reject H₀: μ = 5.0Structs§
- AdfResult
- Result of the Augmented Dickey-Fuller (ADF) unit root test.
- Anderson
Darling Result - Result of the Anderson-Darling normality test.
- Anova
Result - Result of one-way ANOVA.
- Kpss
Result - Result of the KPSS stationarity test.
- Mann
Kendall Result - Result of the Mann-Kendall trend test.
- Shapiro
Wilk Result - Result of the Shapiro-Wilk normality test.
- Test
Result - Result of a hypothesis test.
Enums§
- AdfLags
- How
adf_testchooses the number of lagged differences. - AdfModel
- Model specification for the ADF test.
- Kpss
Lags - The truncation lag of the Newey-West long-run variance in
kpss_test. - Kpss
Model - What the KPSS null hypothesis says the series is stationary around.
- KpssP
Value - Where a
KpssResult::p_valuestands relative to the table it is read from.
Constants§
- ADF_
MIN_ OBSERVATIONS - The fewest values
adf_testtakes. - KPSS_
LEVELS - Significance levels of
KpssResult::critical_values, in order. - KPSS_
MIN_ OBSERVATIONS - The fewest values
kpss_testtakes.
Functions§
- adf_
lags_ domain - The numbers of lagged differences
adf_testtakes ondataundermodel– for a fixed count (lags) and for the bound of the AIC search (max_lags) alike:0..=p, where with p lags the regression keeps n − 1 − p rows (one value is lost to differencing, p to the lags) and has the lagged level, the model’s deterministic terms and p lag columns; it needs at least 5 rows and a residual degree of freedom. - adf_
test - Augmented Dickey-Fuller (ADF) unit root test for stationarity.
- anderson_
darling_ test - Anderson-Darling normality test: H₀: data is normally distributed.
- bartlett_
test - Bartlett test for equality of variances: H₀: all groups have equal variance.
- benjamini_
hochberg - Benjamini-Hochberg FDR correction.
- bonferroni_
correction - Bonferroni correction: adjusts p-values for multiple comparisons.
- chi_
squared_ goodness_ of_ fit - Chi-squared goodness-of-fit test: H₀: observed matches expected distribution.
- chi_
squared_ independence - Chi-squared test of independence on a contingency table.
- fisher_
exact_ test - Fisher exact test for a 2×2 contingency table.
- jarque_
bera_ test - Jarque-Bera normality test: H₀: data is normally distributed.
- kpss_
lags_ domain - The values
kpss_testtakes for a fixed truncation lag ondata:0..=n − 1. - kpss_
test - KPSS test of stationarity: H₀ the series is stationary around a level (or a trend), H₁ it has a unit root.
- kruskal_
wallis_ test - Kruskal-Wallis test: H₀: all groups have the same distribution.
- levene_
test - Levene test for equality of variances: H₀: all groups have equal variance.
- mann_
kendall_ test - Mann-Kendall non-parametric trend test with Sen’s slope estimator.
- mann_
whitney_ u_ test - Mann-Whitney U test: H₀: the two populations have the same distribution.
- one_
sample_ t_ test - One-sample t-test: H₀: μ = μ₀.
- one_
way_ anova - One-way ANOVA: H₀: all group means are equal.
- paired_
t_ test - Paired t-test: H₀: mean difference = 0.
- shapiro_
wilk_ test - Shapiro-Wilk normality test: H₀: data is normally distributed.
- two_
sample_ t_ test - Two-sample Welch t-test: H₀: μ₁ = μ₂ (unequal variances).
- wilcoxon_
signed_ rank_ test - Wilcoxon signed-rank test: H₀: median of differences = 0.