This is my first repeated measures analysis.

Subjects in two groups exercise until "peak" level. Blood is taken at baseline (prior to exercise), peak, 2hrs post, 24 hrs post, and 72hrs post. Levels of various proteins are measured in the blood samples.

Groups: 2 (mutation for disease, control)
Subjects: N
Time Points (exercise): 5 (baseline, peak, 2hr, 24hr, 72hr)
Outcome: continuous variable (protein expression)

Is this description right?

If there is a group effect, then there would be an interaction between group and time. The lack of independence comes from the repeated measurements on the same subjects, so there should be a random effect with time. Because the two groups likely have different baseline measurements, I need to include both random intercepts and random slopes.

Does this seem like the right formula?

outcome ~ subject + group*time + (1 + subject|time)


Based on the comment below, is this right?

outcome ~ group*time + (1 + time | subject)

  • 4
    $\begingroup$ If subjects have your repeated measurements within them, then subjects form the basis for your random effects. In that case you shouldn't list it as a fixed effect (as you do right after the "~") and it should be after the "|" symbol in the random term. Please edit the question to fix that, so that you can get better advice on the statistical issue of how/whether to use random slopes. $\endgroup$
    – EdM
    Nov 15, 2022 at 21:51
  • $\begingroup$ Re: your edit, yes, with the edited code you get fixed effects of group and time and their interaction, random intercept of subject and random slope of time for each subject, which seems like a reasonable model. $\endgroup$
    – Sointu
    Nov 16, 2022 at 9:14
  • 1
    $\begingroup$ One thing to think about: Is subject labeled so that there aren't the same "subjects" in both groups ? That is, do you do not have "Subject 1" in Group 1 and Group 2 ? $\endgroup$ Nov 16, 2022 at 16:40
  • $\begingroup$ @SalMangiafico -- yes. I'm very detailed about setting up tables. A column "subject" has the unique subject IDs. A column "group" has the group IDs. $\endgroup$
    – abalter
    Nov 16, 2022 at 21:51

1 Answer 1


Your edited model could be OK, but you might not be able to estimate random slopes in your design. You say:

Because the two groups likely have different baseline measurements, I need to include both random intercepts and random slopes.

Repeated measurement on individuals with differences in baseline measurements support modeling random intercepts, but that's not an argument for also including random slopes. This site's lmer cheat sheet explains how the form you chose to model random slopes also models correlations between random slopes and intercepts. If this experiment was run only once on each individual, I suspect that you won't have enough data to estimate random slopes.


Your Answer

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

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