Repeated measure clinical trial Linear mixed model I am working on a clinical trial testing an innovative rehabilitation therapy on patients and I would like some suggestions on how to analyse the data.
The study design is:
2-groups: conventional (n=17) vs innovative (n=15) treatment;
4-time points (pre-therapy, T0; halfway through the therapy period, T1; end of therapy, T2; 2 months follow-up, T3).
As output, we record a continuous variable: time (in seconds) to walk from point A to point B. We record multiple values for each subject at each time point (T0,T1,T2,T3).
I have seen articles where the authors used ANOVA to evaluate the change in performance within each group. However, I would also like to evaluate the difference between groups, preferably at each time point as well. I have noticed other studies using Linear Mixed Models.
I thought of setting as Fixed effect: Group, Time-point; Random effect: intercept per subject,
Group per subject.
However, I am not an expert of this technique and I do not really know how to apply it, or how to write it in R/Statsmodels. Can you please help me understand how to set it up and how to write it on a coding platform?
Thanks a lot in advance!
 A: Based on your description, in R you would start with a model such as:
outcome ~ group * time-point + (group | subject)

This will estimate fixed effects for group, time-point and the interaction between them. If you have sufficient statistical power, this will enable you to answer the research questions. The main effect for group will estimate the difference in outcome between the two groups at time-point 0, the main effect for time-point (assuming this is a factor and not continuous) will have 3 estimates, each being the estimated difference in the outcome between each time-point estimate and time-point 0, in the conventional group (that is, if convetional is the reference level for group variable). The interactions will estimate the  difference in the outcome between the two groups for each time-point relative to time-poiht 0.
The model also fits random slopes for group which will allow the "effect" of group to be different for each subject (ie as an offset to the main effect for group)
Often in longitudinal studies you would also want the effect of time (and the interactions) to vary by subject, that is, to fit random slopes, but in this case with relatively few subjects and a time variable with 4 levels it is possible that such a model will not be supported by the data. An alternative would be to code time as continuous but then you would need to know the actual time points of each measurement and possibly allow for non linearity.
