Compute statistics.