Repeated measures mixed model: are we doing the right thing?


Hi everyone,

The data below are part of a larger dataset of water velocities that caused urchins to become detached from kelp fronds. You can see that two “types” of measurement were taken for each urchin: maximum velocity (max) and sustained velocity (pe). These measurements were done randomly (with respect to order of urchin and type).

We think we should just add urchin as a random factor. Does the below mixed model seem right for dealing with these repeated measures?

mod <- lmer(vel_ms ~ diameter_mm * type + (1 | urchin), data)

Thanks for any feedback!
Josh (and David Connolly)


Hi Josh, interesting question. I guess it all depends on what you are trying to answer here?

The model you specified is looking at how much deviation each urchin ID contributes relative to a reference-level intercept. Perhaps it would be easier to interpret if you change your contrast matrix to characterise an average intercept and then look at how urchin ID deviates from that instead of an arbitrary reference level? Again, this won’t change anything really, but it should make the output table from lmer easier to interpret, I think.

Code would be

mod <- lmer(vel_ms ~ diameter_mm * type + (1 | urchin), data, contrasts=list(type='contr.sum'))

I hope that helps?