Function rgsl::statistics::wvariance
[−]
[src]
pub fn wvariance(w: &[f64], wstride: usize, data: &[f64], stride: usize, n: usize) -> f64
This function returns the estimated variance of the dataset data with stride stride and length n, using the set of weights w with stride wstride and length n. The estimated variance of a weighted dataset is calculated as,
\Hat\sigma2 = ((\sum w_i)/((\sum w_i)2 - \sum (w_i2))) \sum w_i (x_i - \Hat\mu)2
Note that this expression reduces to an unweighted variance with the familiar 1/(N-1) factor when there are N equal non-zero weights.