variance method
Calculates variance of items.
Throws StateError if the iterable is empty.
Implementation
double variance() {
if (isEmpty) {
throw StateError('Iterable is empty');
}
// TODO: Optimize?
final mean = this.mean();
return map((e) {
final v = e - mean;
return v * v;
}).mean();
}