Phase transitions and the generalized virial equation of state