npm install lorenz-curve --save
Parameter | Type | Description |
---|---|---|
data |
Number[] |
Data set |
precision |
Number |
Precision for ratios (default: 2) |
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
.
Julian Claus and contributors.
MIT