static double variance(def population) {
long n = 0
double mean = 0
double s = 0.0
population.each {double x ->
n++;
double delta = x - mean
mean += delta / n
s += delta * (x - mean)
}
(s / (n - 1))
}
April + May
6 years ago
No comments:
Post a Comment