Homogeneity Pursuit in Panel Data Models: Theory and Applications