So I conducted an experiment that looked at the effect that a range of temperatures had on the weight of shellfish. There are 7 temperature treatments, each temperature is 1 tank (no replicates, I know its a problem). I took samples twice a week for 1 month (each sample was destructive and approximately 20 randomly sampled organisms). I am trying to find at what sampling day did the changes between treatments become statistically different from each other. My thought is to use a repeated measures general linearized model to test day against size with pH as a fixed factor that interacts with day.

so this is what my r code looks like:

glm(weight ~ Day + Temp + Day*Temp, data = Temp1

Does this make sense for what I am trying to do?


1 Answer 1


In a repeated measurement design you need to account for autocorrelation, so I would suggest using a mixed model.

lmer(weight ~ Days * Temp + (1 + Days | fishID), data = temp1)

Days * Temp automatically expands to Days : Temp + Days + Temp.

  • $\begingroup$ That is a good point thank you! I was initially thinking of pooling all my organismal data together for each treatment since they are not independent of one another, and I was concerned about psuedoreplication. Which means I would not have a subject effect, any thoughts on that? $\endgroup$
    – Jjohn2019
    Nov 28, 2018 at 18:05
  • $\begingroup$ Do you mean your shellfishes by "subject"? If fishID refers to your shellfishes, you can use e.g. ranef() to explore your random effects (which gives you - in this case - the individual differences in weight from the total mean weight as estimated by the model). If you have time-varying predictors, you could fit a "random-effect-within-between model " (see strengejacke.github.io/mixed-models-snippets/…), which gives you estimates on the changing within- and between-subject-effects over time. $\endgroup$
    – Daniel
    Nov 29, 2018 at 11:12
  • $\begingroup$ Yes I do thanks so much, I will explore these ideas further, this has been really helpful $\endgroup$
    – Jjohn2019
    Nov 29, 2018 at 18:27

Your Answer

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

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