Calculate an error probability.