Skip to content

Provide "on line" algorithms for descriptive statistics of streaming data.

Notifications You must be signed in to change notification settings

mapbox/stats-online

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stats! Online.

screen shot 2016-04-27 at 14 52 43

"Online" algorithms are algorithms can process input piece by piece without needing to know the size of the entire set. This is a collection of online stats algorithms for calculating standard deviation, variance, mean, and a minimum sample size using Student's T-Distribution to identify minimum sample sizes.

Installation

Install with npm by using: npm install stats-online

Use

Mean

var stats = require('stats-online');

// calculating the average online
var foo = new stats.incrementer();
for (var i = 0; i < 10; i++){
  foo.push(i);
  console.log(foo.mean());
}

Variance

var stats = require('stats-online');
// calculating the variance online
var foo = new stats.incrementer();
for (var i = 0; i < 10; i++){
  foo.push(i);
  console.log(foo.variance());
}

Standard Deviation

var stats = require('stats-online');

// calculating the standard deviation online
var foo = new stats.incrementer();
for (var i = 0; i < 10; i++){
  foo.push(i);
  console.log(foo.standardDeviation());
}

Sample Size

var stats = require('stats-online');
// calculating the minimum sample size online
var foo = new stats.incrementer();
for (var i = 0; i < 10; i++){
  foo.push(i);
  foo.push(i);
  foo.push(i);
  console.log(foo.minimumSample());
  console.log(foo.sufficientSampleSize());
}

About

Provide "on line" algorithms for descriptive statistics of streaming data.

Topics

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published