pub struct DataSet<T>(pub Vec<T>);Expand description
A high-performance structure encapsulating a linear array of values designed for descriptive and bivariate statistical data mining.
Tuple Fields§
§0: Vec<T>Implementations§
Source§impl DataSet<f64>
impl DataSet<f64>
Sourcepub fn new(data: Vec<f64>) -> Self
pub fn new(data: Vec<f64>) -> Self
Instantiates a new data frame context around a contiguous memory buffer.
§Example
use scicdh::statistics::DataSet;
let ds = DataSet::new(vec![1.0, 2.0, 3.0]);Sourcepub fn mean(&self) -> CDHResult<f64>
pub fn mean(&self) -> CDHResult<f64>
Computes the arithmetic mean ($\mu$) of the sample space.
$$\mu = \frac{\sum_{i=1}^n x_i}{n}$$
Sourcepub fn median(&self) -> CDHResult<f64>
pub fn median(&self) -> CDHResult<f64>
Computes the sample median using a non-destructive 0-indexed sorting pipeline. Handles both odd and even dataset lengths correctly.
Sourcepub fn mode(&self) -> CDHResult<Option<f64>>
pub fn mode(&self) -> CDHResult<Option<f64>>
Computes the statistical mode of the dataset in linear time $\mathcal{O}(n)$.
Uses low-level float bit-packing (to_bits()) to completely bypass
hashing restrictions on f64. Returns Ok(None) if the distribution
is completely uniform (no single clear majority frequency exists).
Sourcepub fn range(&self) -> CDHResult<f64>
pub fn range(&self) -> CDHResult<f64>
Calculates the algebraic range (Span) between the maximum and minimum parameters.
$$\text{Range} = X_{\text{max}} - X_{\text{min}}$$
Sourcepub fn has(&self, value: f64, other: Option<&[f64]>) -> CDHResult<bool>
pub fn has(&self, value: f64, other: Option<&[f64]>) -> CDHResult<bool>
Scans a target container or the internal dataset structure to check for the existence of a precise value.
Fixed Bug: Bypassed memory copying vulnerabilities from previous design.
Sourcepub fn sample_variation_x2(&self) -> CDHResult<f64>
pub fn sample_variation_x2(&self) -> CDHResult<f64>
Computes the sum of squared deviations for the primary variable ($SS_{xx}$).
$$SS_{xx} = \sum x^2 - \frac{(\sum x)^2}{n}$$
Sourcepub fn sample_variation_y2(&self, y: &[f64]) -> CDHResult<f64>
pub fn sample_variation_y2(&self, y: &[f64]) -> CDHResult<f64>
Computes the sum of squared deviations for an independent reference slice ($SS_{yy}$).
$$SS_{yy} = \sum y^2 - \frac{(\sum y)^2}{n}$$
Sourcepub fn sample_variance(&self) -> CDHResult<f64>
pub fn sample_variance(&self) -> CDHResult<f64>
Computes the unbiased sample variance ($s^2$) leveraging Bessel’s correction factor.
$$s^2 = \frac{SS_{xx}}{n - 1}$$
Sourcepub fn sample_std_deviation(&self) -> CDHResult<f64>
pub fn sample_std_deviation(&self) -> CDHResult<f64>
Computes the unbiased sample standard deviation ($s$).
Sourcepub fn sample_coeff_of_variation(&self) -> CDHResult<f64>
pub fn sample_coeff_of_variation(&self) -> CDHResult<f64>
Evaluates the dimensionless sample coefficient of variation ($CV$).
$$CV = \frac{s}{\bar{x}}$$
Sourcepub fn kth_central_moment(&self, k: f64) -> CDHResult<f64>
pub fn kth_central_moment(&self, k: f64) -> CDHResult<f64>
Generates the $k$-th mathematical population central moment ($m_k$).
$$\mu_k = \frac{\sum (x_i - \bar{x})^k}{n}$$
Sourcepub fn skewness(&self) -> CDHResult<f64>
pub fn skewness(&self) -> CDHResult<f64>
Measures the skewness ($\beta_3$), tracking distribution symmetry.
Sourcepub fn kurtosis(&self) -> CDHResult<f64>
pub fn kurtosis(&self) -> CDHResult<f64>
Computes excess kurtosis ($\beta_4$), tracking peak sharpness relative to standard normal shapes.
Sourcepub fn sample_variation_xy(&self, y: &[f64]) -> CDHResult<f64>
pub fn sample_variation_xy(&self, y: &[f64]) -> CDHResult<f64>
Computes the cross-variation sum of joint distribution observations ($SS_{xy}$).
$$SS_{xy} = \sum xy - \frac{(\sum x)(\sum y)}{n}$$
Sourcepub fn pearson_correlation_coeff(&self, y: &[f64]) -> CDHResult<f64>
pub fn pearson_correlation_coeff(&self, y: &[f64]) -> CDHResult<f64>
Evaluates Pearson’s Product-Moment Correlation Coefficient ($r_{xy}$). Hardened against the textbook typo by using $SS_{yy}$ space arrays.
Sourcepub fn into_set(&self) -> CDHResult<Vec<f64>>
pub fn into_set(&self) -> CDHResult<Vec<f64>>
Deduplicates entries from the dataset to form a unique element mathematical set pool.
Sourcepub fn population_variance(&self) -> CDHResult<f64>
pub fn population_variance(&self) -> CDHResult<f64>
Calculates pure population variance ($\sigma^2$) relative to the exact population mean.
Sourcepub fn population_std_deviation(&self) -> CDHResult<f64>
pub fn population_std_deviation(&self) -> CDHResult<f64>
Computes the population standard deviation ($\sigma$).
Sourcepub fn max(&self) -> CDHResult<f64>
pub fn max(&self) -> CDHResult<f64>
Evaluates the peak extreme value bound present inside the dataset.