Skip to main content

Module testing

Module testing 

Source
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.0

Structs§

AdfResult
Result of the Augmented Dickey-Fuller (ADF) unit root test.
AndersonDarlingResult
Result of the Anderson-Darling normality test.
AnovaResult
Result of one-way ANOVA.
KpssResult
Result of the KPSS stationarity test.
MannKendallResult
Result of the Mann-Kendall trend test.
ShapiroWilkResult
Result of the Shapiro-Wilk normality test.
TestResult
Result of a hypothesis test.

Enums§

AdfLags
How adf_test chooses the number of lagged differences.
AdfModel
Model specification for the ADF test.
KpssLags
The truncation lag of the Newey-West long-run variance in kpss_test.
KpssModel
What the KPSS null hypothesis says the series is stationary around.
KpssPValue
Where a KpssResult::p_value stands relative to the table it is read from.

Constants§

ADF_MIN_OBSERVATIONS
The fewest values adf_test takes.
KPSS_LEVELS
Significance levels of KpssResult::critical_values, in order.
KPSS_MIN_OBSERVATIONS
The fewest values kpss_test takes.

Functions§

adf_lags_domain
The numbers of lagged differences adf_test takes on data under model – 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_test takes for a fixed truncation lag on data: 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.