jStat : a JavaScript statistical library.

jStat is a statistical library written in JavaScript that allows you to perform advanced statistical operations without the need of a dedicated statistical language (i.e. MATLAB or R).

jStat dependencies:

The majority of jStat functions can be used independently of any other libraries. However, the plotting functionality of jStat is based on the jQuery plugin - flot. Therefore, to generate plots using jStat the following dependencies are required:

jStat only uses elements that adhere to the jQuery UI ThemeRoller styles so any jQuery UI theme can be used.

A complete production bundle can be downloaded from the downloads page that includes all dependencies and the Aristo jQuery UI theme.

Browser compatability

jStat should work in all major browsers. Most of the limitations arise from the use of the HTML 5 canvas element when plotting. Below is a list of supported browsers:

  • Internet Explorer - versions 7+
  • Firefox - version 3+
  • Safari - version 3.1+
  • Opera - version 9.6+
  • Google Chrome

jStat uses numerous advanced statistical functions that require considerable processing power. This requirement results in differing user experiences depending upon your browser choice. Currently, the fastest browser is Google Chrome. However, most browsers provide satisfactory performance, with the exception of Internet Explorer which has a significant performance hit.

jStat examples:

jStat was designed with simplicity in mind. Using an object-oriented design provides a clean API that can produce results in a few lines of code. jStat also provides a procedural API that mimics R.

To demonstrate the simplicity of jStat a number of examples are provided below. Clicking on the 'execute' button will run the code of each example.

Calculate the 0.95 quantile of a Normal distribution:

var norm = new NormalDistribution(0,1) // normal distribution
var q = norm.getQuantile(0.95);        // the 0.95 quantile
alert(q);                              // output the result

Calculate the cumulative density at a given point of a Beta distribution:

// Calculate the cumulative density of a beta distribution
var cumulative = jstat.pbeta(0.5, 2.3, 4.1);
alert(cumulative);  // output the result

Plot a Normal distribution PDF:

// generate 100 points betwen -5 and 5
var range = jstat.seq(-5,5,100);
// calculate the densities at each point
var densities = jstat.dnorm(range, 0.0, 1.0);
// produce the plot (no formatting)
jstat.plot(range, densities);

Get the latest version:

Fork me on GitHub

Choose your download:



The bundle contains all jStat dependencies and the Aristo jQuery theme.

Current release: v1.0.0

Latest news:

Loading feeds...

Loading latest twitter feeds

Screenshots:

Beta distribution using jStat Student T distribution using jStat