Does anyone know of a good Javascript statistics library, preferably a plugin to JQuery and/or Protovis?

For example, I am keen to make use of Protovis to display box plots (aka box and whisker charts) but the data input format requires me to provide quartile information about the data distribution. Ideally, I'd like a stats library that will take in a data series and produce e.g. quartile information as well as other standard statistical measures (mean, mode, range, sd/variance, etc etc)

asked 29 Apr '11, 17:21

psychemedia's gravatar image

psychemedia ♦♦
1.1k323961
accept rate: 11%

edited 30 Apr '11, 15:48


Two questions: Is JavaScript really the right tool for the job? Do you need each of those stats that you listed?

I ask if JavaScript is the right tool because you'd be sending the entire data set to the browser when something server side, like a database, might be a better solution.

But okay, I'm not the only one to have that thought, so let's assume that you need client side processing. Can't you can get most of what you want by putting a data set column into an array. No real special handling necessary. Once you've sorted your array and checked the length, you're most of the way there. Min, Max, and Range are array[0] and array[length-1]. Median is array[ (length-1)/2 ] with some special handling for even or odd number of records. Quartile or any-tile split is similar to Median. I bet there's an array de-duping function out there somewhere that would get you half-way to mode. And StdDev is pretty much just a quick looping, summing function away.

I know, I know, the point is to find a JavaScript library so you don't have to do the math. But the calcs mentioned above would seem to be easier without a library.

Okay, let's assume you have to go even further than that and really, really need something pre-built to handle data. Check out Sencha. It's not a jQuery plugin and I have no idea if it can do what you want it to do. But they seem to have some data handling capability... so maybe.

link

answered 03 May '11, 00:16

nwenzel's gravatar image

nwenzel
312
accept rate: 0%

The use case I had in mind was for a single web page app that does everything in the client (quick analysis of a network of people recently using a particular Twitter hashtag). As for the use of a library, you spotted "the point". My Javascript is inefficient and messy, and may end up e.g. with a fencepost error, but I would happily used a tested, known to be correct, efficient and elegant library ;-)

(03 May '11, 10:00) psychemedia ♦♦

Suggest http://www.jstat.org/ (though have only read the docs -- not yet used!).

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).

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.

link

answered 29 Apr '11, 17:30

rgrp's gravatar image

rgrp ♦♦
501122027
accept rate: 14%

JStat appears to focus mainly on the generation and display of probability distribution functions? I've clarified the question to narrow down my particular use case....

(30 Apr '11, 15:44) psychemedia ♦♦
-1

im not sure what kind of data you're after but i know http://jsperf.com/ is a phenomenal tool with regards to speed tweaks

If they happened to store any of the submissions at all there might be some interesting bits in there.

link

answered 17 May '11, 04:05

delinquentme's gravatar image

delinquentme
402
accept rate: 50%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×7
×3
×1

Asked: 29 Apr '11, 17:21

Seen: 2,353 times

Last updated: 08 Jun, 04:43

powered by OSQA