Skip to main content

Module statistics

Module statistics 

Source
Expand description

Statistics solver — the single, canonical home for numeric statistics.

Zero-allocation kernels over caller-owned slices, a sibling to solvers::linear_algebra. This is where descriptive statistics, hypothesis tests, correlation, and binning live for the whole engine.

Composition rule (Modality-First): specialized/domain libraries (specialized_libs::statistical_computing, machine_learning, …) marshal their domain data into a slice and call these functions. They MUST NOT carry their own mean/variance/correlation re-implementations. See MODALITY_FIRST_CONSOLIDATION.md.

Probabilistic logic (Bayesian networks, truth-degree reasoning over quins) is a separate concern and lives in modalities::probabilistic; it may call into here for numeric work, but the two are not merged.

Re-exports§

pub use correlation::correlation_p_value;
pub use correlation::kendall;
pub use correlation::pearson;
pub use correlation::rank_into;
pub use correlation::spearman;
pub use descriptive::covariance;
pub use descriptive::kurtosis;
pub use descriptive::max;
pub use descriptive::mean;
pub use descriptive::median_in_place;
pub use descriptive::median_sorted;
pub use descriptive::min;
pub use descriptive::mode_in_place;
pub use descriptive::quantile_in_place;
pub use descriptive::quantile_sorted;
pub use descriptive::skewness;
pub use descriptive::std_dev;
pub use descriptive::sum;
pub use descriptive::variance;
pub use histogram::histogram_into;
pub use histogram::HistRange;
pub use timeseries::autocorrelation;
pub use timeseries::exponential_smoothing_into;
pub use timeseries::moving_average_into;
pub use hypothesis::chi_square_gof;
pub use hypothesis::chi_square_independence;
pub use hypothesis::friedman;
pub use hypothesis::ks_1sample;
pub use hypothesis::mann_whitney_u;
pub use hypothesis::mcnemar;
pub use hypothesis::one_sample_t;
pub use hypothesis::one_way_anova;
pub use hypothesis::paired_t;
pub use hypothesis::two_sample_t;
pub use hypothesis::AnovaResult;
pub use hypothesis::ChiSquareResult;
pub use hypothesis::FriedmanResult;
pub use hypothesis::KolmogorovSmirnovResult;
pub use hypothesis::MannWhitneyResult;
pub use hypothesis::NonparametricResult;
pub use hypothesis::TTest;
pub use hypothesis::TwoSampleTTest;
pub use information::cross_entropy;
pub use information::entropy;
pub use information::kl_divergence;
pub use information::mutual_information_discrete;
pub use regression::simple_linear_regression;
pub use regression::LinearRegression;
pub use robust::iqr;
pub use robust::median_abs_deviation;
pub use robust::trimmed_mean;
pub use robust::winsorized_mean;
pub use distributions::beta_pdf;
pub use distributions::binomial_cdf;
pub use distributions::binomial_pmf;
pub use distributions::empirical_cdf;
pub use distributions::exponential_cdf;
pub use distributions::exponential_pdf;
pub use distributions::gamma_pdf;
pub use distributions::laplace_cdf;
pub use distributions::laplace_pdf;
pub use distributions::lognormal_cdf;
pub use distributions::lognormal_pdf;
pub use distributions::poisson_cdf;
pub use distributions::poisson_pmf;
pub use distributions::uniform_cdf;
pub use distributions::uniform_pdf;
pub use distributions::weibull_pdf;

Modules§

anomaly
Anomaly / outlier detection — folded into the statistics foundation (it is just statistics with a decision rule). Univariate detectors (z-score, robust modified z-score, Tukey fences, Grubbs’ test) plus a multivariate Mahalanobis gate. Each reuses the existing descriptive / robust / distribution primitives and follows the module’s Option idiom (None on degenerate input — empty, zero spread).
correlation
Correlation kernels — zero-allocation over caller-owned slices.
descriptive
Descriptive statistics — zero-allocation kernels over caller-owned slices.
distributions
Probability distributions — the canonical, full-precision pdf / cdf / quantile for the whole engine, built on the shared special functions (special).
histogram
Histogram binning — fills a caller-owned counts buffer, no allocation.
hypothesis
Hypothesis tests — real p-values from the distributions library, zero ad-hoc thresholds.
information
Information theory — Shannon entropy, KL divergence, cross-entropy and mutual information over discrete distributions / samples (all in bits, log₂).
regression
Regression — ordinary least squares. Simple (one-predictor) linear regression with the full inferential output: coefficients, R², residual standard error, and real t-based standard errors / p-values from the distributions library (no placeholder significance).
robust
Robust / exploratory estimators — location and spread measures that resist outliers, the EDA complement to the mean/variance in super::descriptive. They reuse the descriptive median/quantile kernels (no re-implementation).
timeseries
Time-series kernels — autocorrelation, moving average, exponential smoothing.

Functions§

adf_proxy
Simple ADF-like stationarity proxy (negative means more stationary tendency).
bootstrap_means
Basic bootstrap mean (cold bounded, for calibration/validation). Resamples with replacement using provided RNG state (SplitMix style). Writes means for num_samples into out.
ljung_box
Ljung-Box test statistic for autocorrelation up to lag h. acf[0..h] are sample autocorrelations (from lag 1).