Sample size calculations for longitudinal data