Fitting Statistical Models With Multiphase Mean Structures For Longitudinal Data