pub struct PairStats {
pub n: usize,
pub sx: f64,
pub sy: f64,
pub sxy: f64,
pub sx2: f64,
pub sy2: f64,
}Expand description
Statistical summary for paired data analysis.
Accumulates fundamental statistical quantities for bivariate data pairs, providing the building blocks for correlation analysis, regression coefficients, and covariance calculations with SIMD-accelerated computation.
§Fields
n: Count of valid (non-null) data pairssx: Sum of x-values (Σx)sy: Sum of y-values (Σy)sxy: Sum of products (Σxy) for covariance calculationsx2: Sum of x-squared values (Σx²) for variance calculationsy2: Sum of y-squared values (Σy²) for variance calculation
§Applications
These statistics enable efficient calculation of:
- Pearson correlation coefficient: r = (n⋅Σxy - Σx⋅Σy) / √[(n⋅Σx² - (Σx)²)(n⋅Σy² - (Σy)²)]
- Linear regression slope: β₁ = (n⋅Σxy - Σx⋅Σy) / (n⋅Σx² - (Σx)²)
- Sample covariance: cov(x,y) = (Σxy - n⋅x̄⋅ȳ) / (n-1)
- Coefficient of determination: R² for regression analysis
Fields§
§n: usizeCount of valid (non-null) paired observations
sx: f64Sum of x-values (Σx)
sy: f64Sum of y-values (Σy)
sxy: f64Sum of cross-products (Σxy) for covariance computation
sx2: f64Sum of squared x-values (Σx²) for variance computation
sy2: f64Sum of squared y-values (Σy²) for variance computation
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PairStats
impl RefUnwindSafe for PairStats
impl Send for PairStats
impl Sync for PairStats
impl Unpin for PairStats
impl UnwindSafe for PairStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more