# 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?

• How is this part described in the statistical methodology part in the trial protocol and/or the statistical analysis plan? – Michael M Jul 12 at 12:04
• Hi Michael. It is a very good point. This study is carried by several institutes, and the one where I work is not in charge of the statistical analysis. Unfortunately, I have no access to the info you asked. However, I want to learn how to do this analysis. – Flavio.R. Jul 12 at 12:10
• "I thought of setting as Fixed effect: Group, Time-point; Random effect: intercept per subject, treatment per subject.". You mention Group as a variable and also treatment, but aren't they the same ? – Robert Long Jul 12 at 12:17
• Yes, sorry. I change the question. – Flavio.R. Jul 12 at 13:05

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.

• thanks for the clear explanation! You said that the main effect for group will estimate the difference in outcome between the two groups at time-point 0. What if I also what to know the difference between the two groups at other time points? Should I perform any PostHoc test to evaluate the difference among groups at other time points? – Flavio.R. Jul 12 at 19:22
• The interaction terms will inform you about that but they will be contrasts vs the reference level (which I have assumed will me 0. If you want contrasts vs the other levels then you can change the reference level. This introduces problems with multiple testing but I believe there are some additional packages that will handle that (lsmeans is one I am aware of though there are probably others). I would recommend some research around these methods first. – Robert Long Jul 12 at 20:40