// calculates first and second central momentum
double[] m1 = new double[dimension];
double[] m2 = new double[dimension];
ObservationIterator<Vector> iterator = observations.getIterator();
while (iterator.isNextAvailable()) {
Vector x = iterator.getNext();
for (int i = 0; i < dimension; ++i) {
m1[i] += x.getComponent(i);
m2[i] += x.getComponent(i) * x.getComponent(i);
}
}
for (int i = 0; i < dimension; ++i) {
m1[i] /= iterator.getNumIterated();