You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
netdesign edited this page Aug 16, 2011
·
5 revisions
jsArrayStats is a javascript library to simply gets statistics from an Array or Object.
Supported Statistics
jsArrayStats calculates Arithmetic Mean, Geometric Mean and Harmonic Mean against both Arrays and Objects.
How to use
Create a new jsArrayStats object and pass an Array/Object as argument, jsArrayStats will auto-detect Array or Object
//Declare Object
var array = [1, 2, 4, ...];
var arrayToAnalyze = new arrayStats(array);
//Set the output precision
arrayToAnalyze.precision = 4;
//Use the .mean() method to calculate the Arithmetic Mean
var myMean = arrayToAnalyze.mean();
//Use the .geometricMean() method to calculate the Geometric Mean
var myGeoMean = arrayToAnalyze.geometricMean();
//Use the .harmonicMean() method to calculate the Harmonic Mean
var myHarMean = arrayToAnalyze.harmonicMean();