diff --git a/d3.stats.js b/d3.stats.js index 3ed8e942..a96a6986 100644 --- a/d3.stats.js +++ b/d3.stats.js @@ -142,8 +142,8 @@ d3.stats.quantiles = function(d, quantiles) { return ~~q === q ? (d[q] + d[q + 1]) / 2 : d[Math.round(q)]; }); }; -// TODO: replace with more stable algorithm. -// Sample variance. +// Unbiased estimate of a sample's variance. +// Also known as the sample variance, where the denominator is n - 1. d3.stats.variance = function(x) { var mean = d3.stats.mean(x), n = x.length, diff --git a/src/stats/variance.js b/src/stats/variance.js index 21ebbd2b..fbd08f04 100644 --- a/src/stats/variance.js +++ b/src/stats/variance.js @@ -1,5 +1,5 @@ -// TODO: replace with more stable algorithm. -// Sample variance. +// Unbiased estimate of a sample's variance. +// Also known as the sample variance, where the denominator is n - 1. d3.stats.variance = function(x) { var mean = d3.stats.mean(x), n = x.length,