Model Selection and Model Averaging for Longitudinal Data with Application in Personalized Medicine