Javascript – Simple Statistic

Previously i have a post about getting the average value of a numeric array using ?Underscore.

 

If you need more statistical functions other than getting the mean value. You could try Simple Statistics.

Visit the above link and play with it. Here is an example on getting some common statistics value in Javascript.

// numbers from 1 to 100
var myData = [];
for (var i = 0; i < 99; i++) {
  myData[i] = i + 1;
}

ss.mean(myData);
ss.min(myData);
ss.quantile(myData , 0.2);

 

Done =)

Reference:

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.