I am trying to model the adaptation of muscle activities (i.e. integral of electromyographic) across different days (longitudinal study). For each subject (variable sbjID), I measure the variable emg for each gait cycle, muscle, and day of recording. I am using mixed-effect models as follows:

emg.lm <- lme(emg ~ days*muscle, random = ~1|sbjID, data=data_emg, na.action=na.omit, method = "ML")

For the moment, I am modeling days as a factor. The variable muscle is a factor too.

I have two questions:

  1. There are different numbers of gait cycles across days, and also across subjects. Does this unbalance design create issues in the context of mixed-effect models (e.g. bias towards groups with the higher number of cycles)? If that is not the case, you have reference where I can read the theory about it?

  2. There is a certain variability in emg across gait cycles even within the same day, muscle and subject. It needs to be noticed that gait cycles of each subjects are consecutive, and therefore potentially correlated, random events. Do you think I need to take this into account in my model, and how? I am not interested in studying the influence of the gait-cycle sequence on emg (and that's why I have not included as fixed-effect), but I wonder whether, for example, I should include this variable as random effects somehow (e.g. nested withing subject). Any help is greatly appreciated.

Thanks a lot!

EDIT. A person who commented this post told me that since I am treating days as a factor, then I should have random slopes, otherwise I will inflate the estimation of the standard errors. I have additional two questions in these regards:

  1. I have read this type of comments on other posts, but I am not sure I understand it. Can someone provide explanation for it?

  2. If days is a random effect, the interaction term days:muscle will also be a random term. Isn't this equivalent to fit a different model for each subject (and therefore not providing any structure)? Sorry if this question is naive, I am just starting using linear mixed effects, and I am trying to understand.


  • $\begingroup$ Why is day a factor? Continuous allows for a nicer model, IMO, just be sure to have random slope. $\endgroup$ – D_Williams Jul 4 '17 at 0:13
  • $\begingroup$ I agree but it is just a first trial. Could you elaborate on "make sure to have random slope"? I have read it in other posts but I do not understand why it is important. Why cannot the intercept be the only random effect? Also, what about my 2 questions? $\endgroup$ – Cristiano Jul 4 '17 at 0:16
  • $\begingroup$ The intercept only model is incorrect if you hope to have correct p values. That artificially reduces SE of fixed effect. The random slope accounts for the fact that there is variance the slopes. that is, people differ and not accounting for this is disastrous for error rates. as for questions: 1) there are no issues with unbalanced designs and this is a strength of MLM; 2) not sure what you mean here, but of course days are correlated to some degree. see how to specify autoregressive model online somewhere. $\endgroup$ – D_Williams Jul 4 '17 at 0:22
  • $\begingroup$ Thanks! Why does an intercept-only model reduce SE of fixed effects? And why is this the case only if days is a factor? You are assuming that there is variance in the slope. Does it always need to be the case? I would like to understand the theory behind these considerations. Can you suggest a reference? This always gets me confused...if the slope on days was a random variable, wouldn't this be equivalent to fit a completely different model to each subject? As for question (2): even within each day, the gait cycles are consecutive events, thus correlated. How do I account for this? $\endgroup$ – Cristiano Jul 4 '17 at 0:38
  • $\begingroup$ I can't provide all answers. Also, read up about MLM and See Barr et al. keep it maximal. There you'll get answers. Also, if I had the time or desire, id provide an answer and not a comment as I am doing. $\endgroup$ – D_Williams Jul 4 '17 at 0:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.