Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
variance is imprecise when size is small (#418)
In my opinion the current variance (and by consequence the standard deviation) computation are imprecise, when curSize is not high (when curSize < 10 for example): ```java variance = (sumSquares / curSize) - (mean * mean); ``` The computation I suggest in this pull request does not hurt and is precise: ```java if (curSize == 1) { variance = 0d; } else { variance = (sumSquares - ((double) total * total / curSize)) / (curSize - 1); } ``` For reference: http://web.archive.org/web/20050512031826/http://helios.bto.ed.ac.uk/bto/statistics/tress3.html
- Loading branch information