When calculating the CEAC, the function max.col returns a random index. Although this is to be expected when there are ties, however, for our use case, on inspection, there is a true maximum (no tie), and yet random indices are returned. If max.col is replaced with which.max within an apply function on the matrix, the correct indices are returned.