Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including statsjs with all npm packages installed. Try it out:

var statsjs = require("statsjs")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

statsjs v1.0.6

Provides functions for many of the statistical operations that you might need

Stats.js by Angus Gibbs

Provides functions for many of the statistical operations that you might need.


Stats.js currently supports many of the statistical functions that you might need, including

  • regression lines (linear, power, exponential)
  • min, max, mean, median, first quartile, third quartile
  • least common multiple and greatest common factor
  • standard deviation
  • sorting a list of points by an attribute
  • probabilities (binomial, geometric, normal)
  • z procedures

It also supports many of the functions on the data set that you'd expect from Underscore, such as pluck, map, and each.

See the getting started guide for more information.


  • Better documentation
  • Auto-detect best regression line


Patches are welcome, just make sure there are matching unit tests. Tests use mocha with my fork of expect.js (which allows you to assert that a value is within a certain error range of another value). Once you clone the repo (either your fork or this repository), cd into it and run npm install to install mocha and expect.js. Tests can be found within test/test.js.


Stats.js is licensed under the MIT License. See for the full license.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free