stat-fns
v1.0.0
Published
A statistics utility library
Downloads
94
Maintainers
Readme
A statistics utility library
Table of Contents
Install
This project uses node and npm.
$ npm install stat-fns
$ # OR
$ yarn add stat-fns
Usage
const { Stat } = require('stat-fns')
const s = new Stat('65 72 68 64 60 55 73 71 52 63 61 74 69 67 74 50 4 75 67 62 66 80 64 65')
const s2 = new Stat('132 118 124 109 104 101 125 83 99 131 98 125 97 106 112 92 120 103 111 117 135 143 112 112 116 106 117 119 110 105 128 112 126 105 102')
console.log('=== 1 ===\n')
console.log('mean', s.mean())
console.log('max', s.max())
console.log('min', s.min())
console.log('sum', s.sum())
console.log('range', s.range())
console.log('Q1', s.Q1())
console.log('Q2', s.Q2())
console.log('Q3', s.Q3())
console.log('IQR', s.IQR())
console.log('Outliers', s.outliers())
// === 1 ===
// mean 63.375
// max 80
// min 4
// sum 1521
// range 76
// Q1 61.25
// Q2 65.5
// Q3 71.75
// IQR 10.5
// Outliers [ 4 ]
console.log('=== 2 ===\n')
console.log('mean', s2.mean())
console.log('median', s2.median())
console.log('mode', s2.mode())
console.log('standard deviation', s2.standardDeviation())
console.log('coefficient of variation', s2.cv())
console.log('max', s2.max())
console.log('min', s2.min())
console.log(s2.classInterval(), s2.classWidth())
// === 2 ===
// mean 113
// median 112
// mode [ '112' ]
// standard deviation 12.81293988791911
// coefficient of variation 0.11338884856565584
// max 143
// min 83
Docs
WIP
Contribute
- Fork it and create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am "Add some feature"
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
License
MIT