Analysis of longitudinal data using a finite mixture model