diff options
author | Zachary Sloan | 2012-12-06 18:36:39 -0600 |
---|---|---|
committer | Zachary Sloan | 2012-12-06 18:36:39 -0600 |
commit | 8d0199efadafc0c6dff70415f2dc45b5b363da0f (patch) | |
tree | 5b9c61bd53a76d82fcb5f51a358a8b7b17f6d31b /wqflask | |
parent | ef464fe82d8dfd517af2fae775973c46926e4c9b (diff) | |
download | genenetwork2-8d0199efadafc0c6dff70415f2dc45b5b363da0f.tar.gz |
All 10 stats working
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/stats.coffee | 8 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/stats.js | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/wqflask/wqflask/static/new/javascript/stats.coffee b/wqflask/wqflask/static/new/javascript/stats.coffee index d6d39245..bf79d6c3 100644 --- a/wqflask/wqflask/static/new/javascript/stats.coffee +++ b/wqflask/wqflask/static/new/javascript/stats.coffee @@ -36,6 +36,8 @@ class Stats std_error: -> return @std_dev() / Math.sqrt(@n_of_samples()) + # We could also just use the first value here (and last in max) because we assume the + # lists are sorted for things like interquartile (and in fact they are) min: -> return Math.min(@the_values...) @@ -51,8 +53,10 @@ class Stats interquartile: -> length = @the_values.length # Todo: Consider averaging q1 and a3 when the length is odd - q1 = @the_values[Math.round(length * .25)] - q3 = @the_values[Math.round(length * .75)] + console.log("in interquartile the_values are:", @the_values) + console.log("length is:", length) + q1 = @the_values[Math.floor(length * .25)] + q3 = @the_values[Math.floor(length * .75)] iq = q3 - q1 return Math.pow(2, iq) diff --git a/wqflask/wqflask/static/new/javascript/stats.js b/wqflask/wqflask/static/new/javascript/stats.js index 5b7603ba..36e96640 100644 --- a/wqflask/wqflask/static/new/javascript/stats.js +++ b/wqflask/wqflask/static/new/javascript/stats.js @@ -81,8 +81,10 @@ Stats.prototype.interquartile = function() { var iq, length, q1, q3; length = this.the_values.length; - q1 = this.the_values[Math.round(length * .25)]; - q3 = this.the_values[Math.round(length * .75)]; + console.log("in interquartile the_values are:", this.the_values); + console.log("length is:", length); + q1 = this.the_values[Math.floor(length * .25)]; + q3 = this.the_values[Math.floor(length * .75)]; iq = q3 - q1; return Math.pow(2, iq); }; |