I have a longitudinal dataset with variables collected irregularly over time. Each individual has 1 to 10 visits reflecting followup from 0 to 14 yrs. For each individual, I would like to calculate the 'change in a variable' over all possible 1 year time intervals--i.e. I would like to capture all possible 1-year changes in body weight for example. While I can easily program changes from adjacent visits, using subscripting (i.e. weight[_n+1] - weight[_n]), I guess that I will need two loops and matrices to capture data for all possible 1 yr. intervals (not just adjacent ones) for each individual. Unfortunately, I am a beginning programmer--does anyone have any advice for tackling this problem?
Thank you.
Thank you.
Comment