Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/math-utils/wilson-score
Because averages suck
https://github.com/math-utils/wilson-score
Last synced: 9 days ago
JSON representation
Because averages suck
- Host: GitHub
- URL: https://github.com/math-utils/wilson-score
- Owner: math-utils
- License: mit
- Created: 2013-10-11T00:56:08.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2020-07-23T12:28:41.000Z (over 4 years ago)
- Last Synced: 2024-10-28T09:53:30.534Z (15 days ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 41
- Watchers: 1
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wilson Score [![Build Status](https://travis-ci.org/math-utils/wilson-score.png)](https://travis-ci.org/math-utils/wilson-score)
Calculates the lower bound of the [binomial proportion confidence interval](http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval) as calculated by the [Wilson score interval](http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval).
If you're not retarded, you would use this score instead of averages when sorting and ranking (doesn't matter what the user sees).
This is what [reddit uses](http://amix.dk/blog/post/19588) for "best".## API
```js
var wilson = require('wilson-score')
```### wilson(up, total [, z-score])
- `up` - the total number of "yes"s
- `total` - the total number of votes
- `z-score` - the z-score of the interval.
By default, it's ~2.3 which corresponds to a 99% confidence interval.
Use `1.644853` for 95%.Instead of calculating the average as `up / total`,
calculate the wilson score via `wilson(up, total)`.
The wilson score will always be lower than the average.