simple-statistics is a Javascript library I wrote to understand statistics better. It's useful as a node module as well as in the browser with visualization frameworks like d3.

Here are some of the kinds of things you can do:

```
// Find the mean (average) of a set of numbers. This
// takes an array of numbers
var mean = ss.mean([1, 2, 3]);
// The variance of numbers is the sum of the squared
// differences between numbers and the mean of the list.
var variance = ss.variance([1, 2, 3]);
// Create a linear regression based on a dataset of
// two-dimensional arrays. This returns a new function
// that you can call for the value of the line at
// each X value.
var linear_regression_line = ss.linear_regression()
.data([[0, 1], [2, 2], [3, 3]]).line();
linear_regression_line(5);
// The r-squared function can be given a dataset just
// like linear regressions, and it'll tell you roughly how
// close the linear regression comes to actually estimating
// the data.
var r_squared = ss.r_squared([[1, 2]], linear_regression_line);
```