https://github.com/elstats/percentile
Calculate n-th percentile of an observation variable
https://github.com/elstats/percentile
percentile statistics stats
Last synced: about 1 year ago
JSON representation
Calculate n-th percentile of an observation variable
- Host: GitHub
- URL: https://github.com/elstats/percentile
- Owner: elstats
- License: mit
- Created: 2018-03-02T09:43:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T17:44:36.000Z (almost 5 years ago)
- Last Synced: 2024-04-23T16:22:05.750Z (about 2 years ago)
- Topics: percentile, statistics, stats
- Language: JavaScript
- Homepage:
- Size: 202 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Percentile [](http://travis-ci.org/elstats/percentile)
> Calculate n-th percentile
## Installation
```sh
npm install @elstats/percentile
```
## Example 1
```js
import percentile from '@elstats/percentile';
// calculate p75
percentile(
[3, 6, 7, 8, 8, 10, 13, 15, 16, 20],
75
); // → 15
```
## Example 2
```js
const percentile = require('@esltats/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)