# stats-online **Repository Path**: mirrors_mapbox/stats-online ## Basic Information - **Project Name**: stats-online - **Description**: Provide "on line" algorithms for descriptive statistics of streaming data. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2026-02-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Stats! Online. screen shot 2016-04-27 at 14 52 43 ![](https://travis-ci.org/mapbox/stats-online.svg?branch=master) "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](http://www.itl.nist.gov/div898/handbook/prc/section2/prc222.htm). ## Installation Install with `npm` by using: `npm install stats-online` ## Use ### Mean ```javascript 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 ```javascript 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 ```javascript 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 ```javascript 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()); } ```