lorenz-curve
v1.1.0
Published
Get the lorenz curve of a given data set.
Downloads
40
Maintainers
Readme
lorenz-curve
Installation
npm install lorenz-curve --save
API
lorenzCurve(data: Number[], precision: Number)
| Parameter | Type | Description |
|-------------|-------------------|-----------------------------------|
| data
| Number[]
| Data set |
| precision
| Number
| Precision for ratios (default: 2) |
Usage
import lorenzCurve from 'lorenz-curve'
import * as assert from 'assert'
const {x, y} = lorenzCurve([3, 4, 5, 5, 18])
assert.deepEqual(x, [0.2, 0.4, 0.6, 0.8, 1])
assert.deepEqual(y, [0.09, 0.2, 0.34, 0.49, 1])
If you are using require
, you have to attach .default
.
Author
Julian Claus and contributors.
License
MIT