calculate error rate