thirtysixthspan / descriptive_statistics

MIT License
755 stars 69 forks source link

Added Sample Variance & SD #25

Closed jamescgibson closed 10 years ago

jamescgibson commented 10 years ago

The existing methods calculate the 'population' variance and standard deviation. Added methods to calculate the 'sample' versions of these quantities, which provide unbiased estimates of the population parameters when a sample is used to estimate.

P.S. Looks like there were some end-of-line spaces that got truncated automatically by my editor, I'll happily amend to remove these if the commit log noise is an issue.

thirtysixthspan commented 10 years ago

Thanks for this awesome PR! As you correctly note, we calculate the variance of the values in the collection and do not try and estimate the variance of the population from which the values in the collection are derived. Only the former and not the later is within the scope of this gem's target functionality. I've updated the readme with a note to try and make this clearer to users of the gem.

jamescgibson commented 10 years ago

Cool, thanks for the response! Great gem here, I ended up patching it in one project because I needed the sample estimates, and figured you might want to include it - no worries though.

Cheers!