brycebaril / node-stats-lite

A light statistical package that operates on Arrays.
MIT License
74 stars 11 forks source link

Add sampleStdev and sampleVariance methods. #9

Closed johnnaegle closed 6 years ago

johnnaegle commented 6 years ago

The stdev and variance functions, as exposed, continue to be population functions.

When the sample sizes are large enough, the values for sampleStdev and sampleVariance are very close. However, I was using a sample size of 6 and was seeing a large difference. Ultimately, I tracked this down to sample vs population standard deviations (and variances). This package uses stdev as a population functions where software such as postgres and applications such as google sheets use sample functions.

johnnaegle commented 6 years ago

I think I'd flip the names around:

stdevS, stdevP, varianceP, varianceS instead of the longer names sampleStdev, populationStdev, populationVariance, sampleVariance.

Thoughts?

brycebaril commented 6 years ago

I think I prefer the longer names, just for clarity. I've been thinking about other ways to expose this that might also make sense but I haven't come up with anything I like better yet.

brycebaril commented 6 years ago

Published as v2.2.0 Thanks!