In the clinical trial community, it is usually not easy to find a treatment that benefits all patients since the reaction to treatment may differ substantially across different patient subgroups. The heterogeneity of treatment effect plays an essential role in personalized medicine. To facilitate the development of tailored therapies and improve the treatment efficacy, it is important to identify subgroups that exhibit different treatment effects. We consider a very general framework for subgroup identification via the homogeneity pursuit methods usually employed in econometric time series analysis. The change point detection algorithm in our procedure is most suitable for analyzing dense longitudinal or spatial data which are quite common for biomedical studies these days.We demonstrate that our proposed method is fast and accurate through extensive numerical studies. In particular, our method is illustrated by analyzing a diffusion tensor imaging data set. KEYWORDS binary segmentation, change point detection, dense longitudinal data, homogeneity pursuit, personalized medicine, treatment recommendation 3256