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

Modules§

covariance
Covariance and correlation computations.
hypothesis
Statistical Hypothesis Testing

Structs§

AnovaResult
Result of an ANOVA F-test.
ChiSquareResult
Result of a chi-square test.
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.
TTestResult
Result of a t-test.

Enums§

BinMethod
Bin selection methods for histogram construction.

Functions§

chisquare
Chi-square goodness-of-fit test: Tests if observed frequencies match expected.
corr
Computes the Pearson correlation coefficient between two vectors.
corr_matrix
Computes the Pearson correlation matrix for a data matrix.
cov
Computes the covariance between two vectors.
cov_matrix
Computes the covariance matrix for a data matrix.
f_oneway
One-way ANOVA: Tests if multiple groups have the same mean.
ttest_1samp
One-sample t-test: Tests if sample mean differs from population mean.
ttest_ind
Independent two-sample t-test: Tests if two independent samples have different means.
ttest_rel
Paired t-test: Tests if paired samples have different means.