Compute statistics