Calculate arbitrary q-quantiles
- Run
yarn
to bootstrap dependencies
Require and run like so:
const { quantiles, quantileGroups } = require('qquantile')
const data = [3, 6, 7, 8, 8, 10, 13, 15, 16, 20]
quantiles(data, 4) // returns the q-quantiles, in this case, quartiles
// => [7, 9, 15, 20]
quantileGroups(data, 4) // returns the q-quantile groups, in this case, all quartile groups
// => [
// [ 3, 6, 7 ],
// [ 8, 8 ],
// [ 10, 13, 15 ],
// [ 16, 20 ]
// ]
- Run
yarn test
to run the Jest suite tests