# Mixed models for longitudinal data, coding of time

I have a repeated measures design where the main question is to test the differences between groups (3 levels) at specific time points.

The data is balanced with 8 subjects per group and 7 time points.

So far I have used a mixed model in R with the fixed effects Group*Time and random intercepts for the subjects. Then an ANOVA for this model to test the fixed effects. Also made planned mean comparisons to test the groups in some time points.

To the ANOVA, and the mean comparisons make sense I set Time as categorical. The problem is that the adjust is not so good, and I would like to model a curve through the time, so that I should treat Time as numeric.

My question is : Is it possible to make mean comparisons between groups at specific time points when Time is set as integer?

You can indeed compare the group at specific time points when time is treated as a continuous variable. In general, you can test the following hypothesis $$\begin{eqnarray} H_0: X_1 \beta = X_2 \beta\\ H_a: X_1 \beta \neq X_2 \beta \end{eqnarray}$$ where $$\beta$$ are the fixed effects of the model, and $$X_1$$ and $$X_2$$ are two design matrices specifying the means you want to test.
• Just to add to the ‘emmeans part, you may need to use the at` argument to specify the desired time values; otherwise the average time is used. Jan 6, 2020 at 21:44