Heterogeneity modeling and longitudinal clustering