pub struct DescrStatsW { /* private fields */ }Expand description
Weighted descriptive statistics for a 1-D sample.
Wraps a data vector and (optional) case weights and exposes the weighted
mean, (co)variance with a configurable degrees-of-freedom correction, and a
one-sample t-test of the mean. Mirrors the reference DescrStatsW.
Implementations§
Source§impl DescrStatsW
impl DescrStatsW
Sourcepub fn new(data: Array1<f64>, weights: Option<Array1<f64>>, ddof: f64) -> Self
pub fn new(data: Array1<f64>, weights: Option<Array1<f64>>, ddof: f64) -> Self
Construct from data and optional weights (defaulting to all-ones),
with degrees-of-freedom correction ddof (default convention 0).
Sourcepub fn sum_weights(&self) -> f64
pub fn sum_weights(&self) -> f64
Sum of the weights (the effective number of observations).
Sourcepub fn sumsquares(&self) -> f64
pub fn sumsquares(&self) -> f64
Weighted sum of squares of the demeaned data.
Sourcepub fn var_ddof(&self, ddof: f64) -> f64
pub fn var_ddof(&self, ddof: f64) -> f64
Variance with denominator sum_weights - ddof_override.
Sourcepub fn std_ddof(&self, ddof: f64) -> f64
pub fn std_ddof(&self, ddof: f64) -> f64
Standard deviation with denominator sum_weights - ddof_override.
Sourcepub fn std_mean(&self) -> f64
pub fn std_mean(&self) -> f64
Standard error of the weighted mean.
Uses the ddof-adjusted standard deviation rescaled to the population
form and divided by sqrt(sum_weights - 1), exactly as the reference.
Sourcepub fn ttest_mean(&self, value: f64, alternative: Alternative) -> TTestResult
pub fn ttest_mean(&self, value: f64, alternative: Alternative) -> TTestResult
One-sample t-test that the (weighted) mean equals value.
Returns the statistic (mean - value) / std_mean, its t-distribution
p-value with sum_weights - 1 degrees of freedom, and that d.o.f.
Trait Implementations§
Source§impl Clone for DescrStatsW
impl Clone for DescrStatsW
Source§fn clone(&self) -> DescrStatsW
fn clone(&self) -> DescrStatsW
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more