https://github.com/msn0/stats-percentile
:chart_with_upwards_trend: Calculate n-th percentile
https://github.com/msn0/stats-percentile
percentile statistics
Last synced: 9 months ago
JSON representation
:chart_with_upwards_trend: Calculate n-th percentile
- Host: GitHub
- URL: https://github.com/msn0/stats-percentile
- Owner: msn0
- License: mit
- Created: 2015-04-23T09:23:03.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T03:55:45.000Z (over 3 years ago)
- Last Synced: 2025-08-05T05:55:09.657Z (11 months ago)
- Topics: percentile, statistics
- Language: JavaScript
- Homepage:
- Size: 375 KB
- Stars: 13
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Percentile [](http://travis-ci.org/msn0/stats-percentile)
> Calculate n-th percentile
## Installation
```sh
npm install stats-percentile
```
## Example 1
```js
import percentile from 'stats-percentile';
// calculate p75
percentile(
[3, 6, 7, 8, 8, 10, 13, 15, 16, 20],
75
); // → 15
```
## Example 2
```js
const percentile = require('stats-percentile');
function p95() {
return data => percentile(data, 95);
}
p95([
10, 13, 15, 16, 20, 3, 6, 7, 7, 15, 19, 13,
13, 8, 19, 35, 22, 17, 19, 19, 12, 21, 9, 9, 12
]); // → 22
```
## More info
See [Nearest Rank Method](http://en.wikipedia.org/wiki/Percentile#The_Nearest_Rank_method)
## License
MIT © [Michał Jezierski](https://pl.linkedin.com/in/jezierskimichal)