percentile-freq-calculator

1.2.4 • Public • Published

Percentile-Freq-Calculator

This package calculates percentiles given a frequency distribution. Other npm percentile packages assume you have raw unaggregated data points.

npm link

Usage

Takes in data, an array of objects with "myValue" as the name of the key of the primary data and "freq" as the name of the key of the frequency data.

const percentile_freq_calculator = require('percentile-freq-calculator');


const data = [{myValue:1, freq: 1},{myValue:2, freq: 3},{myValue:3, freq: 6}]

percentile_freq_calculator(data, 0.5, "myValue", "freq") // returns the median
=> 3

percentile_freq_calculator(data, 0.1, "myValue", "freq") // returns the 10th percentile
=> 1


Package Sidebar

Install

npm i percentile-freq-calculator

Weekly Downloads

0

Version

1.2.4

License

ISC

Unpacked Size

2.55 kB

Total Files

6

Last publish

Collaborators

  • jackraiden