1.2.0 • Published 9 years ago
math-statistics v1.2.0
math-statistics
This module provides functions for statistical data analysis.
Getting Started
Installation
npm install math-statistics --save
Integration
var statistics = require('math-statistics');
API
statistics.mean(data)
Returns the mean (average) of the numerical data
.
statistics.mean([]) === NaN
statistics.mean([-1]) === -1
statistics.mean([-1, 2, 3, 4, 4]) === 2.4
statistics.mean([-1, 2.5, 3.25, 5.75]) === 2.625
statistics.median(data)
Returns the median (middle value) of the numerical data
.
statistics.median([]) === NaN
statistics.median([-1]) === -1
statistics.median([-1, 3, 5]) === 3
statistics.median([-1, 3, 5, 7]) === 4
statistics.median([-1, 7, 3, 5, 4]) === 4
Running Tests
To run the test suite first install the development dependencies:
npm install
then run the tests:
npm test