[R-sig-ME] nested random effects in lmer

Amanda Barabas @jb201 @end|ng |rom c@@e@edu
Fri Apr 8 14:40:50 CEST 2022


Hello R members,

I have a situation involving nested data for which I couldn’t find a clear
answer and am hoping someone can help.



I do work using laboratory mice. A common study design involves repeated
measures of single animals receiving the same treatment over time. For
these designs, it’s recommended to use a nested design since each animal
typically only experiences one treatment level. It looks like I could code
this by adding these terms to a lmer model:



(1|Mouse) + (1|Treatment:Mouse)



However, we also like to account for sex in the models. A single mouse can
only have one sex, so I would similarly code this nested effect with:



(1|Mouse) + (1|Sex:Mouse)



If I have a single model where Mouse is nested in both Treatment and Sex,
do I need an additional term to reflect this? Would this code be correct?:



(1|Mouse) + (1|Treatment:Mouse) + (1|Sex:Mouse)



For comparison, I’ve previously used JMP for nested models. In JMP, Mouse
nested in both Treatment and Sex would look like this: Mouse(Treatment,
Sex). I’m not sure if the above line of code would be the R equivalent or
if I need to add a term that includes both Treatment and Sex in the same
set of parentheses. My searches weren’t very helpful for this situation.
I’d greatly appreciate any resources anyone may have about this type of
design.

Thanks,
-- 
Amanda Barabas, B.S.
PhD Candidate, Department of Animal Science
Purdue University

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list