stats-percentile
Version:
Calculate n-th percentile
45 lines (30 loc) • 828 B
Markdown
> Calculate n-th percentile
```sh
npm install stats-percentile
```
```js
import percentile from 'stats-percentile';
// calculate p75
percentile(
[],
75
); // → 15
```
```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
```
See [Nearest Rank Method](http://en.wikipedia.org/wiki/Percentile#The_Nearest_Rank_method)
MIT © [Michał Jezierski](https://pl.linkedin.com/in/jezierskimichal)