View on GitHub

mctad.js

Measures of Central Tendency And Dispersion: A JavaScript library for probability & statistics

Download this project as a .zip file Download this project as a tar.gz file

About

mctad.js is a JavaScript library for probability and statistics. It was created to provide functionality missing from other such libraries — such as having an awareness of many common discrete and continuous probability distributions, and the ability to generate random variables from those distributions — although it also provides a growing list of standard descriptive statistics and statistical analyses.

Descriptive Statistics

Given an Array of data, mctad.js can calculate its

There are also public methods for sum and product.

> data = [1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 12, 12, 17];
  [1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 12, 12, 17]
> mctad.sum(data);
  107
> mctad.mean(data);
  8.23076923076923
> mctad.median(data);
  7
> mctad.mode(data);
  [6, 12]

When defined and non-trivial to implement, descriptive statistics are returned with any probability distribution objects you create.

Confidence Intervals

mctad.js can create one- and two-tailed confidence intervals on the:

Probability Distributions

mctad.js can create many common discrete and continuous probability distributions from parameters you supply. The resulting probability distribution objects contain common statistics on the distribution (when defined); convenience methods for accessing probability distribution, probability mass, and cumulative probability functions; domain & range helpers to simplify integration with D3, and random variable generators.

Core and Helpers

mctad.js has a number of methods, included in /src/core. mctad.js uses them internally, but they are available for your use, and include

Documentation for these is interspersed with the code, meaning the Groc-generated documentation is the best place to see how they’re implemented and to learn what they do.

Documentation

Groc-generated documentation is available here and in the /doc directory of your cloned repository.