I have a longitudinal dataset:

DV: Task performance on three within-subject conditions at each time point


  1. Timepoint (variable interval, up to three occasions, missing data at random)
  2. Age at each time-point (variable initial age, variable interval between time-points)
  3. Task categorical variable.

I would like to test for differences between the trajectories of within-person change in each of the three three within-subject task conditions while also accounting for the age differences.

  • What variables should be fixed and random effects (task, age, timepoint)?
  • How do I code timepoint since the intervals are variable?
  • Should I center age by the youngest age in the sample?
  • How do timepoint and age work together?
  • 1
    $\begingroup$ I understand how to use and interpret random slope and random intercepts. However, I'm not sure how to reconcile the two conceptions of time (age, and time points). $\endgroup$ Aug 7, 2015 at 20:10
  • $\begingroup$ What do you mean that timepoint has "intervals [that are] are variable"? $\endgroup$ Aug 7, 2015 at 23:46
  • $\begingroup$ I mean that there are three occasions that participants were tested. The time interval between testing was not fixed. Also the starting age was not fixed and covered a broad age-range. $\endgroup$ Aug 8, 2015 at 1:52
  • $\begingroup$ ID TIMEPOINT AGE SCORE $\endgroup$ Aug 8, 2015 at 1:54

1 Answer 1


Age is a time-varying-covariate. They can be tricky. In this case, you wouldn't include both current age and time, because they would be collinear. Instead, you can have age at baseline as a (static) covariate, and also include timepoint.

  • My guess is that you would have fixed effects for age at baseline, timepoint, and task. You would probably have a random intercept and a (possibly covarying) random slope on timepoint for each subject.
  • You could code the timepoints as time from when each subject began the study. That is timepoint $= 0$ for each subject at the point you first interact with them (either applying some intervention or taking your first measurement). For every additional measurement, timepoint would be the elapsed time since the beginning of their involvement with the study.
  • You needn't necessarily center age. However, the intercept in your model / output will refer to the fitted mean response value when a subject is born, which may not be a meaningful value for you. If you center age, the intercept will refer to the mean response value when a subject's age at baseline is equal to the mean age at baseline of your sample.
  • (See the comment at the beginning.)

Edit: (maybe now I understand what you're doing a little more clearly)

You need to also add an interaction between task and timepoint as a fixed effect, and add (possibly covarying) random effects for task and the task X timepoint interaction. That way, each subject will be able to have their own slope over time for each task. The model will fit the population mean trajectory for each task over time.

  • $\begingroup$ Thank you for your help. I do appreciate it. I've come to a similar conclusion about using time in study for WithinSubject change, while using age (possibly just at time one as a covariate) for BetweenSubject differences after referring to lesahoffman.com/944/944_Lecture11_Alt_Time.pdf. $\endgroup$ Aug 8, 2015 at 5:59
  • $\begingroup$ Im still confused however about how to contrast the developmental trajectories of the three task conditions measured within subject. Right now, I have all three scores in a single column in the data file and use an indicator variable as an IV and as a random effect. But I am just not sure that is right. $\endgroup$ Aug 8, 2015 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.