Simple Mixed Effects Modelling - is it correct? I completed an intervention where participants engaged with an exercise programme and specific outcomes were measured in 4 different times (longitudinal study). For this example, the outcome distance was my response variable. I want to use subject (ID) as a random effect and time as fixed effect.
Therefore, I prepared the following model:
M<-lmer(distance ~ time + (1|ID),L)
The output that I get from anova(M)is:

And the output from summary(M)is the following:

Is it the correct way to do it? Could I then say that there were significant differences between time points that resulted in time3 being significantly different? (in some examples I have not seen time being displayed as levels and that confused me...)
Finally, another question that I have is how can I add covariates? I would like to account for the effect of Age in my model.
Please, find below:

*

*Plot of my data


Plot of the residuals:

Any help would be greatly appreciated!
Best wishes,
Anna


Is it the correct way to do it?

It is one way to do it ! With only 4 time points it is perfectly reasonable to treat time as discrete, particularly since there appears to be some non-linearity. I would suggest that you plot the data to assess this further.

Could I then say that there were significant differences between time points that resulted in time3 being significantly different? (in some examples I have not seen time being displayed as levels and that confused me...)

You may be confused because if you treat time as numeric you will only get 1 estimate (for the linear slope) whereas when you treat it as discrete, as you have, then each of time points 2, 3 and 4 get their own estimate, which is interpreted as the expected change in the outcome between the time point in question, and time point 1. So there is very little evidence of any difference between time 1 and time 2, but there is strong evidence of a difference of 21.9 between time 1 and time 3; and finally, weak evidence of small difference between time 1 and time 4. Since the difference between time 1 and 2 is much larger than between 1 and 3, this suggests a nonlinear association. As mentioned above, you should also plot the data to assess this.

Finally, another question that I have is how can I add covariates? I would like to account for the effect of Age in my model.

All you need to do is add it to the model:
distance ~ time + age + (1|ID)

