Skip to main content

Module stats

Module stats 

Source
Expand description

Traditional descriptive statistics for vector data.

This module provides high-level statistical operations built on top of Trueno’s SIMD-optimized primitives. Key features:

  • Quantiles and percentiles using R-7 method (Hyndman & Fan 1996)
  • Five-number summary (min, Q1, median, Q3, max)
  • Histograms with multiple bin selection methods
  • Hypothesis testing (t-tests, chi-square, ANOVA)
  • Covariance and correlation matrices
  • Optimized with Toyota Way principles (QuickSelect for O(n) quantiles)

§Examples

use aprender::stats::DescriptiveStats;
use trueno::Vector;

let data = Vector::from_slice(&[1.0, 2.0, 3.0, 4.0, 5.0]);
let stats = DescriptiveStats::new(&data);

assert_eq!(stats.quantile(0.5).expect("median should be computable for valid data"), 3.0); // median
assert_eq!(stats.quantile(0.0).expect("min quantile should be computable for valid data"), 1.0); // min
assert_eq!(stats.quantile(1.0).expect("max quantile should be computable for valid data"), 5.0); // max

Re-exports§

pub use covariance::corr;
pub use covariance::corr_matrix;
pub use covariance::cov;
pub use covariance::cov_matrix;
pub use hypothesis::chisquare;
pub use hypothesis::f_oneway;
pub use hypothesis::ttest_1samp;
pub use hypothesis::ttest_ind;
pub use hypothesis::ttest_rel;
pub use hypothesis::AnovaResult;
pub use hypothesis::ChiSquareResult;
pub use hypothesis::TTestResult;

Modules§

covariance
Covariance and correlation computations.
hypothesis
Statistical Hypothesis Testing

Structs§

DescriptiveStats
Descriptive statistics computed on a vector of f32 values.
FiveNumberSummary
Five-number summary: minimum, Q1, median, Q3, maximum.
Histogram
Histogram representation with bin edges and counts.

Enums§

BinMethod
Bin selection methods for histogram construction.