variance property

num variance

Returns the variance of this list, assuming this list is a sample.

See popVariance for the assumption that this list is a population.

Implementation

num get variance {
  num totvar = 0;
  var avg = mean;
  for (var i in this) {
    totvar += pow(i-avg, 2);
  }
  return totvar/(length-1);
}