aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/stats.coffee8
-rw-r--r--wqflask/wqflask/static/new/javascript/stats.js6
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);
};