code: function VarianceFunction(win) {
    var self = this, m, m2, d, n;
    self.name = "vars";
    self.type = "simple";
    self.init = function() { m = 0; m2 = 0; d = 0; n = 0; };
    self.accumulate = function(v) { n+=1; d = v - m; m = d/n + m; m2 = m2 + d*(v - m); };
    self.compensate = function(v) { n-=1; d = m - v; m = m + d/n; m2 = d*(v - m) + m2; };
    self.emit = function()  { return m2/(n-1); };
    self.make = function(win) { return new VarianceFunction(win); };
  }
docs: Get the sample variance of all the things