I have two groups of individuals, each individual has a score measured multiple times and I have constructed a mixed model as follows with both individual slopes and intercepts allowed to vary:

lme(score ~ Group * Time , random = ~Time|Subject, data=df)

The data looks roughly like this at the group level:

enter image description here

I would like to do 2 things:

  1. Estimate the time point at which the blue and red groups becomes equivalent in terms of score i.e. the red and blue line crossover, and also estimate a confidence interval for this value.

  2. Test at certain time points e.g. Day 200 whether the blue and red groups are significantly different from one another in terms of score.

Time is treated continuously - not as a factor, because time points at which score is measured vary between individuals.



  • $\begingroup$ Is there a reason to prefer your model instead of "score ~ Group, random = ~1|Subject + 1|Time"? I am assuming that, for each subject, you have data on multiple levels of "Time". $\endgroup$
    – smndpln
    Jul 15, 2021 at 12:42
  • 2
    $\begingroup$ Your current formulation is modeling a linear effect of time. Thus, the tendency line you have in the figure is quite misleading - are you really interested in this kind of non-linear pattern, or you are aware that the model will fit a straight line for each group? That said, you can probably solve both of your questions by calculating a confidence interval on the model estimates. $\endgroup$
    – LeoRJorge
    Jul 15, 2021 at 13:04
  • $\begingroup$ @smndpln I do have multiple time points for each subject, I am not sure how to implement your suggested alternative in lme. $\endgroup$
    – RobMcC
    Jul 16, 2021 at 13:33
  • $\begingroup$ @LeoRJorge I am aware the model will fit a straight line and I am happy with this. If you are able to describe precisely how one would do solve my questions in R I would be most grateful $\endgroup$
    – RobMcC
    Jul 16, 2021 at 13:34

1 Answer 1


Sorry, I'm not so familiar with the nlme package to give you a code solution, but as long as you are able to build Confidence Intervals for your model parameters (for lme4 models I would use predictInterval from merTools and build a newData dataframe with all combinations of time values from 0 to 300 and both groups), you are able to define your predicted mean and the confidence around the score for every time value and group, and then you can address both questions:

  1. The prediction for both groups to be equivalent is the time value where both groups have the same mean, and similarly for the confidence intervals, you'll have a band of values where both groups are not distinguishable, where the confidence intervals overlap.

  2. As you will have the confidence interval for every time value, you can check for any time, whether the intervals overlap.


Your Answer

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

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