aggregatejs
A set of statistical and mathematical aggregation functions written in JavaScript.
Installation
$ npm install aggregatejs
Example
;// top-level exports can be imported individually (recommended);; ;// => 250 ;// => -100 ;// => -12.5 ;// => 75
API
All aggregate functions are returning a value based on array of numbers:
average
Returns the average of the numbers in array
.
let value = ;// => 75
count
Counts the numbers in array
.
let value = ;// => 6
max
Returns the largest number in array
.
let value = ;// => 250
min
Returns the smallest number in array
.
let value = ;// => -100
percentile
Returns the k
-th percentile of values in array
.
let perc25 = ;// => -12.5 let perc50 = ;// => 100 let perc95 = ;// => 225
sum
Returns the sum of all numbers in array
.
let value = ;// => 450
median
Returns the median of the numbers in array
.
let value = ;// => 100
variance
Returns the variance population of the numbers in array
.
let value = ;// => 4
deviation
Returns the standard deviation of the numbers in array
.
let value = ;// => 2
Running tests
$ npm test