https://github.com/gabrielrufino/samplesize
📊 Package to determine the ideal sample size for a survey
https://github.com/gabrielrufino/samplesize
math mathmatics samplesize statistics
Last synced: about 1 year ago
JSON representation
📊 Package to determine the ideal sample size for a survey
- Host: GitHub
- URL: https://github.com/gabrielrufino/samplesize
- Owner: gabrielrufino
- License: unlicense
- Created: 2021-10-16T14:17:19.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-16T22:05:30.000Z (about 1 year ago)
- Last Synced: 2025-04-17T10:13:24.759Z (about 1 year ago)
- Topics: math, mathmatics, samplesize, statistics
- Language: TypeScript
- Homepage: https://samplesize.gabrielrufino.com
- Size: 1.29 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Sample Size
[](https://gabrielrufino.com)
[](https://github.com/gabrielrufino/samplesize/actions/workflows/ci.yml)
[](https://github.com/gabrielrufino/samplesize/actions/workflows/cd.yml)
Package to determine the correct sample size for a survey
### What is Sample Size?
Every survey needs an ideal number of responses according to the survey's target audience. This is where a statistical calculation that determines the desired sample size comes in.
The calculation is based on three important variables: population size, confiability rate and margin of error.
* **N**: The population size
* **z**: Score calculated from the confiability rate
* **e**: Margin of error
* **p**: Constant, generally 0.5
More information [here](https://www.surveymonkey.com/mp/sample-size-calculator/).
### Getting started
Install the package:
```bash
npm install @gabrielrufino/samplesize
```
Calculate the sample size:
```js
import SampleSize from '@gabrielrufino/samplesize'
const size = SampleSize.calculate({
population: 3000,
confidence: SampleSize.confidences['90%'],
errorMargin: 0.05,
})
console.log(size) // 250
```
### License
UNLICENSED