From ed4c11e31d9c5f9192923b94f4552383cbb96109 Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Fri, 19 May 2017 16:38:40 +0200 Subject: [PATCH] Improve documentation of different weighted mean standard errors --- src/weighted_average.rs | 5 +++++ src/weighted_average2.rs | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/weighted_average.rs b/src/weighted_average.rs index 0c39595..b5fcd60 100644 --- a/src/weighted_average.rs +++ b/src/weighted_average.rs @@ -77,6 +77,11 @@ impl WeightedAverage { /// /// Note that this will return 0 if the sum of the weights is 0. /// For this estimator the sum of weights should be larger than 1. + /// + /// This biased estimator uses the weighted variance and the sum of weights. + /// It considers the weights as (noninteger) counts of how often the sample + /// has been observed, applying the standard formulas to calculate mean, + /// variance and sample size across all "repeats". pub fn error(&self) -> f64 { // This uses the same estimate as SPSS. // diff --git a/src/weighted_average2.rs b/src/weighted_average2.rs index 479b6bf..d11f7ba 100644 --- a/src/weighted_average2.rs +++ b/src/weighted_average2.rs @@ -112,6 +112,9 @@ impl WeightedAverage { /// Estimate the standard error of the weighted mean of the sequence. /// /// Returns 0 if the sum of weights is 0. + /// + /// This unbiased estimator assumes that the samples were independently + /// drawn from the same population with constant variance. pub fn error(&self) -> f64 { // This uses the same estimate as WinCross. //