Skip to content

Implements Student's T-Distribution to identify minimum sample sizes

License

Notifications You must be signed in to change notification settings

mapbox/sample-sizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

sample-sizer

screen shot 2016-04-27 at 14 52 43

Sample Sizer uses Student's T-Distribution to identify minimum sample sizes. If you find yourself asking the question, "do I have enough data?" you'll be able to answer your question with this tool.

Minimum Sample Sizes

The calculation of a minimum sample size a function of your samples Degrees of Freedom, Standard Deviation, and T-Critical Value, which is a function of those Degrees of Freedom and your desired Confidence level.

Installation

To add to your project, install with:

npm install sample-sizer

Usage

When you call the main function in index.js, you'll need to provide a sample (array), a confidence value (float), and an error tolerance (int).

The following code asks the question, "If this is my sample, how many observations do I need to estimate the population average +/- 3, with 90% confidence.

var sizer = require('sample-sizer');
var minimumSize1 = sizer([1,2,3,2,1,2,3,99], .9, 3);

If the number you get is less than the length of your sample array, you need to increase your sample size! You can't be (as) confident (as you want to be) that your data is representative of the population.

About

Implements Student's T-Distribution to identify minimum sample sizes

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published