r specifying random effects

21 Views Asked by At

I have a dataset with repeated measurements among participants (Subjects).

Each subject is tied to a Site (Iowa, Kansas, Tennessee, ....). A subject can only be in one Site and does not appear in two different sites. { A participant is only in one State. Cannot appear in two states at the same time.}

My goal is to

a) estimate random intercepts for both Site and Subject.

b) Nest the subject under their respective Sites

So is this correct ?

lme4::lmer(outcome ~ a1 + x1 + (1 | SiteID / SubjectID), data=df) 

Thanks in advance for any advise.

enter image description here

0

There are 0 best solutions below