calculate error rate and variance at the same time